You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnresponse()->json(['success'=> false, 'error'=> "No email address provided"]);
108
+
}else{
109
+
$user =
110
+
User::where('email', '=', $input['email'])
111
+
->where('type', "fb")
112
+
->where('fbID', $input['fbID'])
113
+
->first();
114
+
115
+
//Refactor the code below
116
+
if ($user){
117
+
//Log user in
118
+
$email = $user->email;
119
+
$password = $email;
120
+
121
+
$credentials = [
122
+
'email' => $email,
123
+
'password' => $password
124
+
];
125
+
126
+
try {
127
+
// attempt to verify the credentials and create a token for the user
128
+
if (! $token = JWTAuth::attempt($credentials)) {
129
+
returnresponse()->json(['success' => false, 'error' => 'Invalid Credentials. Please make sure you entered the right information and you have verified your account. '], 401);
130
+
}
131
+
} catch (JWTException$e) {
132
+
// something went wrong whilst attempting to encode the token
// attempt to verify the credentials and create a token for the user
173
+
if (! $token = JWTAuth::attempt($credentials)) {
174
+
returnresponse()->json(['success' => false, 'error' => 'Invalid Credentials. Please make sure you entered the right information and you have verified your account. '], 401);
175
+
}
176
+
} catch (JWTException$e) {
177
+
// something went wrong whilst attempting to encode the token
// attempt to verify the credentials and create a token for the user
318
+
if (! $token = JWTAuth::attempt($credentials)) {
319
+
returnresponse()->json(['success' => false, 'error' => 'Invalid Credentials. Please make sure you entered the right information and you have verified your account. '], 401);
320
+
}
321
+
} catch (JWTException$e) {
322
+
// something went wrong whilst attempting to encode the token
0 commit comments