NAME
Slovo::Task::SendPasswEmail - sends email to user containing one time password.
SYNOPSIS
# common configuration for similar Tasks in slovo.conf
my $mail_cfg = {
token_valid_for => 24 * 3600,
'Net::SMTP' => {
new => {
Host => 'mail.example.org',
#Debug => 1,
SSL => 1,
SSL_version => 'TLSv1',
SSL_verify_mode => 0,
Timeout => 60,
},
auth => ['slovo@example.org', 'Pa55w03D'],
mail => 'slovo@example.org',
},
};
#load the plugin via slovo.conf
plugins => [
#...
#Tasks
{'Task::SendOnboardingEmail' => $mail_cfg},
{'Task::SendPasswEmail' => $mail_cfg},
],
DESCRIPTION
Slovo::Task::SendPasswEmail extends Slovo::Task::SendOnboardingEmail. This is poor design, but quick and working solution for now. It implements tasks for sending email for forgotten password and for deleting the temporary password.
METHODS
The following methods are implemented.
register
Reads the configuration and adds the implemented tasks to Minion.
TASKS
The following tasks are implemented.
mail_passw_login
Sends an email containing one time password to users who claim they forgot their password. It uses "send_mail_by_net_smtp" in Slovo::Task::SendOnboardingEmail to send the mail. The taks is invoked by action "lost_password_form" in Slovo::Controller::Auth
Arguments: $job, $to_user, $domain
.
job
is the job object provided by Minion. $to_user
is a hash reference containing the user properties found in a users
table record. $domain
is the current domain.
my $job_id = $c->minion->enqueue(
mail_passw_login => [$user, $c->req->headers->host]);
delete_passw_login
Arguments: $job, $uid, $token
.
Invoked by "mail_passw_login". Deletes the temporary password after delay $CONF->{token_valid_for}
.
$app->minion->enqueue(delete_passw_login => [$to_user->{id}, $token] =>
{delay => $CONF->{token_valid_for}});