public function userPasswordChangeFormSubmitted($button) { $values = $button->getForm()->getValues(); //Nacitanie hodnot formulara if ($values->new_heslo != $values->new_heslo2) { $this->flashRedirect('this', $this->trLang('PasswordChangeForm_new_heslo2_ar'), 'danger'); } $this->clen = $this->user_profiles->find($values->id); //Najdenie clena if (!$this->hasser->CheckPassword($values->heslo, $this->clen->users->password)) { $this->flashRedirect('this', $this->trLang('pass_incorect'), 'danger'); } //Vygeneruj kluc pre zmenu hesla $new_password = $this->hasser->HashPassword($values->new_heslo); $values->new_heslo = 'xxxxx'; //Len pre istotu $values->new_heslo2 = 'xxxxx'; //Len pre istotu try { $this->users->find($this->clen->id_users)->update(['password' => $new_password]); $this->user_profiles->uloz(['modified' => StrFTime("%Y-%m-%d %H:%M:%S", Time())], $values->id); $this->flashMessage($this->trLang('pass_change_ok'), 'success'); } catch (Exception $e) { $this->flashMessage($this->trLang('pass_change_err') . $e->getMessage(), 'danger,n'); } $this->redirect('UserLog:'); }
public function userPasswordResetFormSubmitted($form) { $values = $form->getValues(); //Nacitanie hodnot formulara if ($values->new_heslo != $values->new_heslo2) { $this->flashRedirect('this', $this->trLang('reset_pass_hesla_err'), 'danger'); } //Vygeneruj kluc pre zmenu hesla $new_password = $this->hasser->HashPassword($values->new_heslo); $values->new_heslo = 'xxxxx'; //Len pre istotu $values->new_heslo2 = 'xxxxx'; //Len pre istotu try { $this->users->find($values->id)->update(['password' => $new_password, 'new_password_key' => NULL, 'new_password_requested' => NULL]); $this->flashRedirect('User:'******'reset_pass_ok'), 'success'); } catch (Exception $e) { $this->flashRedirect('Homepage:', $this->trLang('reset_pass_err') . $e->getMessage(), 'danger,n'); } }