Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Route::post('/api/rest/login', function () {
- $username = Input::get('username');
- $password = Input::get('password');
- $error = false;
- //transformar el passwword que me ha ingresado el usuario en hash con lfuncion que he usado
- $password = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
- $user = array(
- 'username' => $username,
- 'password' => $password
- );
- $statuscode = 200;
- $message = 'conection sucessfull';
- $statuscodefail = 400;
- $messagefail = 'connection failure';
- if (Auth::attempt($user))
- {
- return Response::json($statuscode, $message);
- //->with('flash_notice', 'You are successfully logged in.');
- }
- else
- {
- // authentication failure! lets go back to the login page
- return Response::json($statuscodefail,$messagefail);
- } //->with('flash_error', 'Your username/password combination was incorrect.')
- //->withInput();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement