diff --git a/lib/LDV/I18N/ru.pm b/lib/LDV/I18N/ru.pm index 1393935..6558430 100644 --- a/lib/LDV/I18N/ru.pm +++ b/lib/LDV/I18N/ru.pm @@ -14,6 +14,7 @@ our %Lexicon = 'Login' => 'Имя входа', 'Log in' => 'Войти', 'Password' => 'Пароль', + 'New password' => 'Новый пароль', 'Current password' => 'Действующий пароль', 'Display name' => 'Отображаемое имя', 'Email' => 'Эл. почта', diff --git a/lib/LDV/User.pm b/lib/LDV/User.pm index c50d990..de0cdd1 100644 --- a/lib/LDV/User.pm +++ b/lib/LDV/User.pm @@ -109,6 +109,11 @@ sub update { } my $error = $self->app->ldap->update($user, \%attrs); 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; } or do { $self->flash({result => "Can't save profile: $@"}); diff --git a/templates/user/profile.html.ep b/templates/user/profile.html.ep index 35c8d13..7fe0269 100644 --- a/templates/user/profile.html.ep +++ b/templates/user/profile.html.ep @@ -33,6 +33,12 @@ <%= l('Avatar') %> <%= file_field 'photo' %> +% if (config->{user}->{allow_chpass}) { + + <%= l('New password') %> + <%= password_field 'newpass', placeholder => '******' %> + +% }
<%= l('Current password') %>