Slovo::Controller::Auth - и миръ Его не позна.


Slovo::Controller::Auth implements actions for authenticating users. It depends on functionality, provided by Mojolicious::Plugin::Authentication. All the routes' paths mentioned below are easily modifiable because they are described in lib/Slovo/resources/etc/routes.conf thanks to Mojolicious::Plugin::RoutesConfig.


Mojolicious::Plugin::Authentication implements the following actions.


Displays a form for confirmation of the names of the user who invited the new user.

    GET /first_login/<token:fl_token>

fl_token is a route type matching qr/[a-f0-9]{40}/.


Compares the entered names of the inviting user with the token and makes other checks. Signs in the user for the first time.


Route: {get => '/in', to => 'auth#form', name => 'authform'}.

Renders a login form. The password is never transmitted in plain text. A digest is prepared in the browser using JavaScript (see lib/Slovo/resources/templates/auth/form.html.ep). The digest is sent and compared on the server side. The digest is different in every POST request.



    any  => '/lost_password',
    to   => 'auth#lost_password_form',
    name => 'lost_password_form'

In case the request is not POST $c->url_for('lost_password_form') displays a form for entering email to which a temporary password to be send. If the request method is POST, enqueues "mail_passw_login" in Slovo::Task::SendPasswEmail, if a user with the given email is found in the database.


Route: {post => '/in', to => 'auth#sign_in', name => 'sign_in'}.

Finds and logs in a user locally. On success redirects the user to home_upravlenie. On failure redirects again to the login page.


This is a callback when user tries to access a page under /manage. If user is authenticated returns true. If not, returns false and redirects to "form".


Allow access to only authenticated members of the admin group. All routes generated by Minion::Admin are under this route.

    GET /manage/minion


Slovo::Controller::Auth inherits all methods from Slovo::Controller and implements the following new ones.


Slovo::Controller::Auth implements the following functions executed or used by Mojolicious::Plugin::Authentication.


Returns the name of the helper used for getting the properties of the current user. The name is user. It is passed in configuration to Mojolicious::Plugin::Authentication to generate the helper with this name. This value must not be changed. Otherwise you will get runtime errors all over the place because $c->user is used a lot.


This function is passed to Mojolicious::Plugin::Authentication as reference. See "USER-LOADING" in Mojolicious::Plugin::Authentication.


This function is passed to Mojolicious::Plugin::Authentication as reference. See "USER-VALIDATION" in Mojolicious::Plugin::Authentication.


Mojolicious::Plugin::Authentication, Slovo::Task::SendOnboardingEmail