Last active
December 16, 2015 22:49
-
-
Save rodurma/5509536 to your computer and use it in GitHub Desktop.
Fazendo login normal com laravel, caso falhar tenta com o hash antigo. Ideal para quando está migrando sites antigos para o framework Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (Auth::attempt($data)) | |
{ | |
// .. do your redirect | |
} | |
elseif ($user = User::where_email($data['email'])->first() and $user->password == md5($data['password'])) | |
{ | |
$user->password = Hash::make($data['password']); | |
$user->save(); | |
Auth::login($user->id); | |
} | |
else | |
{ | |
// login failed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment