fix email register

This commit is contained in:
2024-12-05 16:50:58 +03:00
parent e41f3faa42
commit 8778c4d725
2 changed files with 31 additions and 2 deletions

View File

@ -81,7 +81,8 @@ class SecureController extends AdminController
$user = $this->userService->getByField('email', $email);
if (!$user){
$password = md5(microtime() . bin2hex(random_bytes(10)) . time());
$password = bin2hex(random_bytes(8));
UserService::createUserByEmailAndPassword($email, $password);
$user = $this->userService->getByField('email', $email);
@ -124,7 +125,7 @@ class SecureController extends AdminController
$this->redirect("/admin", code: 302);
} else {
Flash::setMessage("error", "Wrong code.");
$this->redirect("/admin/login", code: 302);
$this->cgView->render("enter_code.php", ['email' => $_COOKIE["user_email"]]);
}
}