m
This commit is contained in:
@@ -11,14 +11,15 @@ class AuthService implements AuthServiceInterface
|
||||
{
|
||||
public function attemptLogin(array $credentials, Request $request): array
|
||||
{
|
||||
if (!Auth::attempt(['mail' => $credentials['mail'], 'password' => $credentials['password']])) {
|
||||
// Manual MD5 password check
|
||||
$user = User::where('mail', $credentials['mail'])->first();
|
||||
if (!$user || $user->pass !== md5($credentials['password'])) {
|
||||
return ['success' => false, 'error_key' => 'mail', 'error_msg' => __('auth.failed')];
|
||||
}
|
||||
|
||||
// Log the user in manually
|
||||
Auth::login($user);
|
||||
$request->session()->regenerate();
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->status != User::STATUS_ACTIVE) {
|
||||
Auth::logout();
|
||||
return ['success' => false, 'error_key' => 'mail', 'error_msg' => __('auth.inactive')];
|
||||
|
||||
Reference in New Issue
Block a user