aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CatDap/Controller/register.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CatDap/Controller/register.pm')
-rw-r--r--lib/CatDap/Controller/register.pm40
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 {