Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $credentials = $request->only('Email', 'Password');
- // Try hashed login
- if (!Auth::attempt($credentials)) {
- $user = User::where('Email', $credentials['Email'])->first();
- // Hashed login failed, attempt legacy (sha256) login and convert if successful
- if ($user->Password == hash('sha256', $credentials['Password'])) {
- $user->Password = Hash::make($credentials['Password']);
- $user->save();
- Auth::login($user);
- } else {
- return response()->json([
- 'message' => 'The credentials you entered were incorrect',
- ], 401);
- }
- } else {
- return redirect()->intended('dashboard');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement