Revize 18ac9009
Přidáno uživatelem Ondřej Fibich před asi 9 roky(ů)
application/controllers/login.php | ||
---|---|---|
$this->index(FALSE, __('You have been successfully logged out.'));
|
||
}
|
||
|
||
/**
|
||
* Function shows page for changing one time password
|
||
*/
|
||
public function change_password()
|
||
{
|
||
$error = '';
|
||
|
||
$user_model = new User_Model($this->user_id);
|
||
|
||
if ($user_model->password_is_onetime != 1)
|
||
{
|
||
url::redirect('login');
|
||
}
|
||
|
||
if ($this->input->post('submit') != '')
|
||
{
|
||
if ($this->input->post('password') == $this->input->post('confirm_password'))
|
||
{
|
||
try
|
||
{
|
||
$user_model->transaction_start();
|
||
|
||
$user_model->password_is_onetime = 0;
|
||
$user_model->password = sha1($this->input->post('password'));
|
||
|
||
$user_model->save_throwable();
|
||
|
||
$user_model->transaction_commit();
|
||
|
||
status::success('Password has been successfully changed');
|
||
url::redirect('login');
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$user_model->transaction_rollback();
|
||
|
||
throw $e;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$error = url_lang::lang('validation.matches', array(__('Password'), __('Confirm password')));
|
||
}
|
||
}
|
||
|
||
$view = new View('login/change_password');
|
||
$view->title = __('New password');
|
||
$view->error = (!$error) ? $this->session->get_once('err_message') : $error;
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
Také k dispozici: Unified diff
Fix merge issue that removed all staff from developer branch :-).