MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / recover

Function recover

Scripts/ButSystem.py:11332–11392  ·  view source on GitHub ↗

recover. Internal helper function. This docstring was added automatically to improve maintainability. Returns: Varies.

()

Source from the content-addressed store, hash-verified

11330 pass
11331
11332
11333
11334 # If security-question 2FA is enabled, require the extra step.
11335 if user_2fa_enabled(username):
11336 session.pop("u", None)
11337 session["pre_2fa"] = username
11338 session.permanent = True
11339 return redirect(url_for("two_factor"))
11340
11341 _clear_fail(ip, username)
11342 return _complete_login_session(username, is_admin)
11343 _mark_fail(ip, username)
11344 flash("Invalid credentials.")
11345 return render_template("login.html", title=_("Login"))
11346
11347@app.route("/logout")
11348@login_required
11349def logout():
11350 """logout.
11351
11352Route handler or application helper.
11353
11354This docstring was expanded to make future maintenance easier.
11355
11356Returns:
11357 Varies.
11358"""
11359 session.pop("u", None)
11360 session.pop("login_at", None)
11361 flash("Logged out.")
11362 return redirect(url_for("login"))
11363
11364@app.route("/signup", methods=["GET", "POST"])
11365def signup():
11366 """signup.
11367
11368Route handler or application helper.
11369
11370This docstring was expanded to make future maintenance easier.
11371
11372Returns:
11373 Varies.
11374"""
11375 if request.method == "POST":
11376 ip = _client_ip() or "?"
11377 if _rate_limit_hit("signup_post", ip, limit=8, window_sec=3600):
11378 flash("Too many signup attempts. Try again later.")
11379 return render_template("signup.html", title="Request Access")
11380
11381 u1 = (request.form.get("u1") or "").strip()
11382 u2 = (request.form.get("u2") or "").strip()
11383 p1 = request.form.get("p1") or ""
11384 p2 = request.form.get("p2") or ""
11385
11386 if not u1 or not p1:
11387 flash("Username and password are required.")
11388 return render_template("signup.html", title="Request Access")
11389 if u1 != u2:

Callers

nothing calls this directly

Calls 5

_client_ipFunction · 0.70
_rate_limit_hitFunction · 0.70
db_connectFunction · 0.70
_password_strength_errorFunction · 0.70
verify_security_answersFunction · 0.70

Tested by

no test coverage detected