Support the ongoing development of Laravel.io →
posted 9 years ago
Authentication
Last updated 1 year ago.
0

Joe96 said:

Hey, i have this code

  	$auth = User::where('Nome', '=', Input::get('username'))->where('Senha', '=', >Hash::make(Input::get('password')))->first();

I guess it should be:

$auth = User::where('Nome', '=', Input::get('username'))->where('password', '=',Hash::make(Input::get('password')))
->first();
Last updated 1 year ago.
0

psychonetic said:

Joe96 said:

Hey, i have this code

 	$auth = User::where('Nome', '=', Input::get('username'))->where('Senha', '=', >Hash::make(Input::get('password')))->first();

I guess it should be:

$auth = User::where('Nome', '=', Input::get('username'))->where('password', '=',Hash::make(Input::get('password'))) ->first();

Why does it have to be password?

Last updated 1 year ago.
0

Hey Joe, Is there an easier way.

$data = Input::only('username', 'password','rememberme');
/**
 * Maybe form validation
 * $validation = Validation::make($data, [
 * 	'username' => 'required',
 * 	'password' => 'required'
 * ]);
 * if ($validation->fails()) {
 * 		Redirect back and show error message
 * }
 */
$credentials = [
	'Nome' => $data['username'],
	'Senha' => $data['password']
];

if (Auth::attempt($credentials), isset($data['rememberme']) ?: false) {
	return Redirect::intended('home');
} else {
	// Redirect back and show error message
}

http://laravel.com/docs/security

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe96 joe96 Joined 28 Apr 2014

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.