Support the ongoing development of Laravel.io →
posted 8 years ago
Validation
Last updated 1 year ago.
0
Solution

If you're following this guide: http://laravel.com/docs/5.1/authentication

You shouldn't make any query manually:

if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) {
    // The user is active, not suspended, and exists.
}

You can pass to attempt an array with all keys you want. The password value will be automatically hashed, you can add all fields you need to that array.

0

slillo said:

If you're following this guide: http://laravel.com/docs/5.1/authentication

You shouldn't make any query manually:

if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) { // The user is active, not suspended, and exists. }

You can pass to attempt an array with all keys you want. The password value will be automatically hashed, you can add all fields you need to that array.

Worked perfectly, thank you so much sir.

Last updated 8 years ago.
0

Where exactly is that line? I can't seem to find it in my installation. I am using Laravel 5.2

Or should I create a new Controller, with only that function and then modify my routes to point to that controller ?

0

Would also like to know where to change this?

0

Anyone please help me out, I am also stuck to validate users while getting logged-in. I want to validate users having column 'active'. Users should not be get logged-in if they have 0 in active column means inactive state.

Thanks.

0

Finally I found the answer from a champion :-)

http://stackoverflow.com/a/31016210/202351

Last updated 7 years ago.
0

But what if i want to check i.e. status not equals to Deleted or Inactive ?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mikkas70 mikkas70 Joined 19 Jun 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.