LoginController
extends z_controller
in package
The Login controller handles all login/logout stuff
Besides index (login) and logout it serves the actions signup, forgot_password, reset, verify, create_password and change_password.
Table of Contents
- action_change_password() : mixed
- Reroutes internally (no HTTP redirect) to action_reset without a reset code
- action_create_password() : mixed
- Reroutes internally (no HTTP redirect) to action_reset without passing a reset code
- action_forgot_password() : mixed
- Serves the forgot password page, or on submit emails a reset link to an existing user and answers JSON ("success", or "error" for an unknown address)
- action_index() : mixed
- The index action
- action_logout() : mixed
- Logs out the requesting user by delegating to Response::logout(): invalidates the session, switches back to the exec user when sudoed, then redirects to the root URL and exits.
- action_reset() : mixed
- Serves the page where the user can reset its password
- action_signup() : mixed
- Controls the view for registering as a user: renders the signup form, or for the "signup" action validates email and password, creates the user, assigns the role from the config registerRoleId (registerRoleIdSecondary for the "Secondary" type), mails the verification link and answers success or an error.
- action_verify() : mixed
- Used to verify mails: verifies the URL token; with POST "email" it resends the verification mail and renders the wait page, otherwise it renders the result view
- twoFactorLogin() : mixed
- Redeems a two factor challenge and starts the session behind it.
- blockedByLoginLimit() : bool
- send_verify_mail() : mixed
Methods
action_change_password()
Reroutes internally (no HTTP redirect) to action_reset without a reset code
public
action_change_password(Request $req, Response $res) : mixed
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_create_password()
Reroutes internally (no HTTP redirect) to action_reset without passing a reset code
public
action_create_password(Request $req, Response $res) : mixed
Meant for users who create their password for the first time, but action_reset then dies with "code not valid"
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_forgot_password()
Serves the forgot password page, or on submit emails a reset link to an existing user and answers JSON ("success", or "error" for an unknown address)
public
action_forgot_password(Request $req, Response $res) : mixed
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_index()
The index action
public
action_index(Request $req, Response $res) : mixed
It will be called when no action is specified: renders the login form, or for a post with "name" checks rate limit and password, then answers with an error, a two factor challenge or a started session.
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_logout()
Logs out the requesting user by delegating to Response::logout(): invalidates the session, switches back to the exec user when sudoed, then redirects to the root URL and exits.
public
action_logout(Request $req, Response $res) : mixed
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_reset()
Serves the page where the user can reset its password
public
action_reset(Request $req, Response $res) : mixed
For access the user needs a code he usally gets per mail. This code will also identify the user so he does not need to be logged in to reset his password; an invalid code dies with a plain-text error, a POSTed password is saved, the code disabled and the client redirected to root
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_signup()
Controls the view for registering as a user: renders the signup form, or for the "signup" action validates email and password, creates the user, assigns the role from the config registerRoleId (registerRoleIdSecondary for the "Secondary" type), mails the verification link and answers success or an error.
public
action_signup(Request $req, Response $res) : mixed
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —action_verify()
Used to verify mails: verifies the URL token; with POST "email" it resends the verification mail and renders the wait page, otherwise it renders the result view
public
action_verify(Request $req, Response $res) : mixed
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —twoFactorLogin()
Redeems a two factor challenge and starts the session behind it.
public
twoFactorLogin(Request $req, Response $res) : mixed
Reached over its own route, so the modal can post from any page.
Parameters
- $req : Request
-
The request object
- $res : Response
-
The response object
Return values
mixed —blockedByLoginLimit()
private
blockedByLoginLimit(User $user) : bool
Parameters
- $user : User
Return values
bool —send_verify_mail()
private
send_verify_mail(Request $req, Response $res, mixed $userId) : mixed
Parameters
- $req : Request
- $res : Response
- $userId : mixed