NAME

Slovo::Task::SendOnboardingEmail - Send an email with link for first time login

SYNOPSIS

  #load the plugin via slovo.conf
  plugins => [
    #...
    #Tasks
        {
         'Task::SendOnboardingEmail' => {
            token_valid_for => 24 * 3600, #24 hours
            smtp            => {
                  ssl       => 1,
                  port      => 465,
                  timeout   => 30,
                  mailhost  => 'mail.example.com',
                  mail_from => 'onboarding@example.com',
                  username  => 'onboarding@example.com',
                  password  => 'pas5w0r4',
            },
         }
        },
    ],

DESCRIPTION

This is the first Minion task implemented in Slovo.

Slovo is not integrated with any social network. A plugin can be relatively easily written and there are maybe already some Mojolicious::Plugin written. Ado had such functionality by leveraging Mojolicious::Plugin::OAuth2.

Slovo takes another approach. Its users can invite each other to join the set of sites one Slovo instance manages. Slovo is the social network it self. We may use Mojolicious::Plugin::OAuth2::Server at some point.

A user in Slovo can create others users' accounts. Upon creation of the new user account an email is sent to the new user. In the email there is a link for the first time login fo the new user. The new user follows the link and is signed in after confirming the names of the user who created his account. After that the user has to change his password to be able to sign in next time.

Slovo::Task::SendOnboardingEmail inherits Mojolicious::Plugin and implements the following functionality.

METHODS

Only one method is implemented.

register

Reads the configuration and adds the implemented tasks to Minion.

TASKS

The following tasks are provided.

mail_first_login

Prepares and sends email using Net::SMTP to the newly created user. The email contains a link for the first sign in. The task is enqued upon creation of the new account. The first time sign in is implemented in "first_login_form" in Slovo::Controller::Auth and "first_login" in Slovo::Controller::Auth.

delete_first_login

Deletes the record with the login token fro the new user. The task is enqued by "mail_first_login" with delay token_valid_for as configured. Defaults to 24 hours after creation of the account.

SEE ALSO

Slovo::Controller::Auth