public function verify($input, $existingHash) { // If we have a 32char string w/o a $ at the beginning, it's probably a unsalted md5 hash if (strlen($existingHash) == 32) { if ($existingHash[0] !== '$') { return Utils::compareStr(md5($input), $existingHash); } } return parent::verify($input, $existingHash); }
public function signIn() { // if signed in, redirect to content if (Session::get('user_email')) { return Request::redirect('/elsa/content'); } if (Input::all()) { $email = Input::get('email'); $password = Input::get('password'); if ($email && $password && User::find($email) && Hash::verify($password, User::find($email)->password)) { Session::put('user_email', $email); return Request::redirect('/elsa/content'); } } return View::make('signin')->getInSystem(); }
public function login($username, $password) { $results = DB::fetch(array('user' => ['user_id', 'password']), array('username' => $username)); $results = $results[0]; if (count($results) === 1) { if (Hash::verify($password, $results->password)) { Session::login($results->user_id); DB::updateIf('user', array('last_login' => time()), array('user_id' => Session::get('user_id'))); Redirect::ref(); return TRUE; } else { return FALSE; } } else { return FALSE; } }