Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // UserController.php
- public function signin(Request $request) {
- $credentials = $request->only('email', 'password');
- $email = $request->input('email');
- // Check if login attempts above 3
- // Here I need to get the 'login_attempts' value
- $loginAttempts = AppUser::where('email', $email)->value('login_attempts');
- if($loginAttempts >= 3){
- // Response: To many attempts
- }
- try{
- // Some JWT Auth validation
- }
- } catch (JWTException $e) {
- // Increase failed login counter
- // $attemptedUser-> <--- Here i need to increase the 'login_attempts' for the user with the email of the login request
- $attemptedUser->save();
- }
- // Some more validation and response
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement