PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 30, 2022

[FIXED] Want to modify laravel default login to check user is verified or not

 January 30, 2022     laravel, laravel-5, laravel-5.6, php     No comments   

Issue

I have written code for email verification. I want to change my login controller behavior so that it will only allow verified users only.

I have status field in database that will store user is verified or not by storing 0/1. Now on login request I have to check email, password, as well as status code is equal to 1. If verified, the user will be redirected to dashboard otherwise redirect to login with error message.

I have done all email verification things.

Please let me know what inputs you want.


Solution

Update your LoginController

need to write following function there

protected function authenticated($request, $user){

    if(!$user->is_active){
        //logic here 

    }
}

In above example, is_active is your table attribute where you have user status...!!



Answered By - Ramzan Mahmood
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing