diff options
author | Buchan Milne <buchan@mageia.org> | 2010-11-04 11:59:43 +0000 |
---|---|---|
committer | Buchan Milne <buchan@mageia.org> | 2010-11-04 11:59:43 +0000 |
commit | f867429bab6efe18a21c4fd531ecbe4eff8cff40 (patch) | |
tree | 79950a5bc6548e151b149022def27119811accf4 /lib/CatDap/Controller/register.pm | |
parent | 171bd5f8e175faa05549ff53ed43e134a5543354 (diff) | |
download | identity-f867429bab6efe18a21c4fd531ecbe4eff8cff40.tar identity-f867429bab6efe18a21c4fd531ecbe4eff8cff40.tar.gz identity-f867429bab6efe18a21c4fd531ecbe4eff8cff40.tar.bz2 identity-f867429bab6efe18a21c4fd531ecbe4eff8cff40.tar.xz identity-f867429bab6efe18a21c4fd531ecbe4eff8cff40.zip |
Switch to View::Email::Template for emails
Complete password reset by admin, and localise in user's preferredLanguage
Localise all /user content
Require re-entry of current password on password change
Clean up debugging
Diffstat (limited to 'lib/CatDap/Controller/register.pm')
-rw-r--r-- | lib/CatDap/Controller/register.pm | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/lib/CatDap/Controller/register.pm b/lib/CatDap/Controller/register.pm index 3838f26..5ad8e19 100644 --- a/lib/CatDap/Controller/register.pm +++ b/lib/CatDap/Controller/register.pm @@ -91,6 +91,8 @@ sub check : Local { my $password = $ug->create_str(); my $cn = $c->request->params->{gn} . " " . $c->request->params->{sn}; $c->log->info("Creating account for user $username"); + $c->log->debug("Preferred language(s)"); + $c->log->debug(Dumper($c->languages)); $mesg = $c->model('Proxy')->add($dn, attr => [ objectclass => [ 'inetOrgPerson' ], @@ -100,48 +102,36 @@ sub check : Local { mail => $email, pwdReset => 'TRUE', userPassword => $password, + preferredLanguage => $c->{languages}[0], ] ); - if ($mesg) { + if ($mesg->code) { push @errors,$mesg->error; $c->log->info( sprintf("Creating DN $dn failed: %s", $mesg->error) ); $c->stash(errors => \@errors); #$c->stash(template => 'register/index.tt'); } - my $text = <<EOF; -Dear %s, -Your Mageia indentity has been successfully created, but requires activation. -To activate your account, please follow the link below. -%s?username=%s&key=%s -EOF - my $body = $c->loc( - sprintf( - $text, - $c->request->params->{gn}, - $c->uri_for('/user/firstlogin'), - $username, - $password - ) + $c->stash( + email => { + 'to' => $email, + 'from' => ${$c->config}{'emailfrom'}, + 'subject' => ${$c->config}{'apptitle'} . " - " . $c->loc('Activation'), + 'template' => 'activation.tt', + }, + cn => $cn, + url => $c->uri_for('/user/firstlogin') . "?username=$username&key=$password", ); - $c->stash->{email} = { - to => $email, - from => ${$c->config}{emailfrom}, - subject => ${$c->config}{apptitle} . " - " . $c->loc('Activation'), - body => $body, - }; $c->log->info("Sending activation mail for user $username to $email"); - $c->forward( $c->view('Email') ); + $c->forward( $c->view('Email::Template') ); if ( @{ $c->error } ) { my $errors = join "\n",@{ $c->error }; $c->log->info("Sending activation mail to $email failed: $errors"); - $c->response->body($c->loc('An error occured sending the email, but your account was created. Please try the password recovery process f you entered the correct email address: [_1]', $errors)); + $c->response->body($c->loc('An error occured sending the email, but your account was created. Please try the password recovery process if you entered the correct email address. Errors [_1]', $errors)); $c->error(0); # Reset the error condition if you need to } - $c->stash(template => 'register/complete.tt'); - $c->stash(message => 'Check your email'); } sub captcha : Local { |