public function onSuccess()
 {
     $v = $this->values;
     $user = $this->orm->users->getByEmail($v->email);
     if ($user && $user->registered) {
         $this->addError('duplicate');
         return;
     }
     if (!$user) {
         $user = new User();
         $user->email = $v->email;
         $this->orm->users->attach($user);
     }
     $user->gender = $v->gender;
     $user->setNames($v->name);
     $user->registered = TRUE;
     $plainHash = Passwords::hash($v->password);
     $user->password = $this->aes->encrypt($plainHash);
     $this->orm->flush();
     /** @var Auth $presenter */
     $presenter = $this->presenter;
     $presenter->user->login(new Identity($user->id));
     $this->iLog('auth.registration.password', ['entropy' => $this->entropy->compute($v->password, $user)]);
     $presenter->onLogin($user, TRUE);
 }
 public function onSuccess()
 {
     $v = $this->values;
     /** @var Auth $presenter */
     $presenter = $this->presenter;
     $user = $presenter->userEntity;
     $plainHash = Passwords::hash($v->password);
     $user->password = $this->aes->encrypt($plainHash);
     $this->orm->flush();
     $this->iLog('form.changePassword', ['entropy' => $this->entropy->compute($v->password, $user)]);
     $presenter->flashSuccess('auth.changePassword.success');
     $presenter->redirect('Profile:');
 }