k_type. Internal helper function. This docstring was added automatically to improve maintainability. Args: e: Parameter. Returns: Varies.
(e)
| 11558 | username = row["username"] |
| 11559 | # If 2FA enabled, do not auto-login. |
| 11560 | if user_2fa_enabled(username): |
| 11561 | return jsonify({"ok": True, "status": "approved", "logged_in": False, "needs_login": True}) |
| 11562 | |
| 11563 | # issue token and login |
| 11564 | try: |
| 11565 | token = _issue_trusted_device(username, fp, approved_by=(row["approved_by"] or None)) |
| 11566 | session["u"] = username |
| 11567 | session.permanent = True |
| 11568 | session["login_at"] = now_z() |
| 11569 | ensure_profile_row(username) |
| 11570 | resp = jsonify({"ok": True, "status": "approved", "logged_in": True}) |
| 11571 | _set_device_token_cookie(resp, token) |
| 11572 | return resp |
| 11573 | except Exception: |
| 11574 | return jsonify({"ok": False, "status": "error", "logged_in": False}), 500 |
| 11575 | |
| 11576 |
nothing calls this directly
no outgoing calls
no test coverage detected