UserToken Methoden static hinzugefügt

Bug bei Passwortlängencheck gefixt
JS Request URLs auf getUrl umgebaut
2FA Code wird bei eingabe nun üngiltig
This commit is contained in:
Spitzer_Daniel
2023-08-28 15:25:59 +02:00
parent f95d0b0074
commit 28ca65fa6d
6 changed files with 33 additions and 25 deletions

View File

@@ -18,14 +18,8 @@ class UserProfileController extends mfBaseController
protected function indexAction()
{
$this->layout()->setTemplate("UserProfile/Index");
$this->layout()->set("userprofile", $this->me);
// $email = new Emailnotification();
// $email->setSubject('testemail');
// $email->setBody('Testemail');
// $email->setTo('daniel.spitzer@inode.at');
// $email->send();
}
protected function addAction()
@@ -115,6 +109,7 @@ class UserProfileController extends mfBaseController
$r = $this->request;
$id = $this->me->id;
$User = new User($id);
$data = [];
if ($User->twofactor != 0) {
$requestcode2fa = $r->code;
$userCode2fa = $User->twofactorcode;
@@ -125,10 +120,11 @@ class UserProfileController extends mfBaseController
$this->layout()->setFlash("Verifizierungscode ungültig", "error");
$this->redirect("UserProfile/edit");
}
$data['twofactorcode'] = NULL;
$data['twofactortimestamp'] = NULL;
}
$data = [];
$data['name'] = trim($r->name);
if ($User->twofactor != 1) {
$data['email'] = trim($r->email);
@@ -184,7 +180,7 @@ class UserProfileController extends mfBaseController
$this->layout()->setFlash("altes Passwort falsch", "error");
$this->redirect("UserProfile");
}
if (strlen($newpwd < 8)) {
if (strlen($newpwd) < 8) {
$this->layout()->setFlash("neues Passwort muss min. 8 Zeichen haben", "error");
$this->redirect("UserProfile");
}
@@ -253,6 +249,9 @@ class UserProfileController extends mfBaseController
$id = $this->me->id;
$User = new User($id);
$data['twofactor'] = $r->twofactor;
$data['twofactorcode'] = NULL;
$data['twofactortimestamp'] = NULL;
$User->update($data);
$User->save();
$this->layout()->setFlash("Zwei-Faktor-Authentifizierung aktiv", "success");