Browse Source

* LDV::User->create : send confirmation email

master
Alex 'AdUser' Z 10 years ago
parent
commit
9216db4d30
  1. 13
      lib/LDV/User.pm

13
lib/LDV/User.pm

@ -75,10 +75,17 @@ sub create {
die("$error") if $error;
$error = $self->app->ldap->update($user, {mail => $mail});
die("$error") if $error;
$error = $self->app->ldap->chpass($user, $pass);
die("$error") if $error;
# TODO: confirmation email
if ($self->app->{user}->{confirm_register}) {
my $body = $self->render_partial(template => 'email/reg_success', format => 'txt')
my $email = $self->app->email->create($mail, $self->l("Registration"), $body);
$error = $self->app->email->send($to, $email);
die("$error") if $error;
# TODO: generate and store recover code
} else {
$error = $self->app->ldap->chpass($user, $pass);
die("$error") if $error;
}
$self->flash({result => "Success! Now you may log in."});
$self->redirect_to('/user/profile'); 1;

Loading…
Cancel
Save