Skip to content

Instantly share code, notes, and snippets.

@jlogsdon
Created May 5, 2010 20:38
Show Gist options
  • Save jlogsdon/391389 to your computer and use it in GitHub Desktop.
Save jlogsdon/391389 to your computer and use it in GitHub Desktop.
<?php
use \lithium\security\Auth;
use \lithium\util\String;
Auth::config(array(
'account' => array(
'adapter' => 'Form',
'model' => 'Account',
'fields' => array('login'),
)
));
Auth::applyFilter('check', function($this, $params, $chain) {
$user = $chain->next($this, $params, $chain);
$data = $params['credentials']->data;
if (!$user) {
return false;
}
$hashed = String::hash($data['password'], 'sha1', $user['salt']);
if ($hashed != $user['password']) {
return false;
}
return $user;
});
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment