Skip to content

Instantly share code, notes, and snippets.

@rodurma
Last active December 16, 2015 22:49
Show Gist options
  • Save rodurma/5509536 to your computer and use it in GitHub Desktop.
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
<?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