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