api auth email

This commit is contained in:
2024-12-09 13:46:10 +03:00
parent 8778c4d725
commit 62ed358a4b
10 changed files with 156 additions and 43 deletions

View File

@ -41,7 +41,7 @@ class UserService
* @param string $value
* @return mixed
*/
public function getByField(string $field, string $value)
public static function getByField(string $field, string $value): mixed
{
return User::where($field, $value)->first();
}
@ -91,8 +91,6 @@ class UserService
$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();
}