Slovo::Task::SendPasswEmail - sends email to user containing one time password.
# 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}, ],
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.
The following methods are implemented.
Reads the configuration and adds the implemented tasks to Minion.
The following tasks are implemented.
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, $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.
job
$to_user
users
$domain
my $job_id = $c->minion->enqueue( mail_passw_login => [$user, $c->req->headers->host]);
Arguments: $job, $uid, $token.
$job, $uid, $token
Invoked by "mail_passw_login". Deletes the temporary password after delay $CONF->{token_valid_for}.
$CONF->{token_valid_for}
$app->minion->enqueue(delete_passw_login => [$to_user->{id}, $token] => {delay => $CONF->{token_valid_for}});
Slovo::Controller::Auth, Slovo::Task::SendOnboardingEmail.
To install Slovo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Slovo
CPAN shell
perl -MCPAN -e shell install Slovo
For more information on module installation, please visit the detailed CPAN module installation guide.