fix register email

This commit is contained in:
2024-12-05 15:16:39 +03:00
parent 9e446563b2
commit bc6c35167e
3 changed files with 46 additions and 18 deletions

View File

@ -85,4 +85,15 @@ class UserService
return $this->getByField("access_token", $token);
}
public static function createUserByEmailAndPassword(string $email, string $password): void
{
$user = new User();
$user->email = $email;
$user->username = $email;
$user->password_hash = password_hash($password, PASSWORD_DEFAULT);
$user->auth_code = mt_rand(100000, 999999);
$user->auth_code_expires_at = date("Y-m-d H:i:s", strtotime("+5 minutes"));
$user->save();
}
}