Browse Source

* ability to change password

master
Alex 'AdUser' Z 10 years ago
parent
commit
bfc01166c5
  1. 1
      lib/LDV/I18N/ru.pm
  2. 5
      lib/LDV/User.pm
  3. 6
      templates/user/profile.html.ep

1
lib/LDV/I18N/ru.pm

@ -14,6 +14,7 @@ our %Lexicon =
'Login' => 'Имя входа', 'Login' => 'Имя входа',
'Log in' => 'Войти', 'Log in' => 'Войти',
'Password' => 'Пароль', 'Password' => 'Пароль',
'New password' => 'Новый пароль',
'Current password' => 'Действующий пароль', 'Current password' => 'Действующий пароль',
'Display name' => 'Отображаемое имя', 'Display name' => 'Отображаемое имя',
'Email' => 'Эл. почта', 'Email' => 'Эл. почта',

5
lib/LDV/User.pm

@ -109,6 +109,11 @@ sub update {
} }
my $error = $self->app->ldap->update($user, \%attrs); my $error = $self->app->ldap->update($user, \%attrs);
die("$error\n") if $error; die("$error\n") if $error;
if ($self->app->config->{user}->{allow_chpass} and
my $newpass = $self->req->param('newpass')) {
$error = $self->app->ldap->chpass($user, $newpass);
die("$error\n") if $error;
}
$self->redirect_to('/user/profile'); 1; $self->redirect_to('/user/profile'); 1;
} or do { } or do {
$self->flash({result => "Can't save profile: $@"}); $self->flash({result => "Can't save profile: $@"});

6
templates/user/profile.html.ep

@ -33,6 +33,12 @@
<td><%= l('Avatar') %></td> <td><%= l('Avatar') %></td>
<td><%= file_field 'photo' %></td> <td><%= file_field 'photo' %></td>
</tr> </tr>
% if (config->{user}->{allow_chpass}) {
<tr>
<td><%= l('New password') %></td>
<td><%= password_field 'newpass', placeholder => '******' %></td>
</tr>
% }
<tr><td colspan='2'><hr/></td></tr> <tr><td colspan='2'><hr/></td></tr>
<tr> <tr>
<td><%= l('Current password') %></td> <td><%= l('Current password') %></td>

Loading…
Cancel
Save