Guest User

Untitled

a guest
Oct 28th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. protected function check_credentials($user, $password)
  2. {
  3. if ( ! is_object($user))
  4. {
  5. $username = $user;
  6.  
  7. // Load the user
  8. $user = ORM::factory('user');
  9. $user->where($user->unique_key($username), '=', $username)->find();
  10. }
  11.  
  12. // If the passwords match, perform a login
  13. if ($user->has('roles', ORM::factory('role', array('name' => 'login'))) AND $user->password === $password)
  14. {
  15. return TRUE;
  16. }
  17.  
  18. // Login failed
  19. return FALSE;
  20. }
Add Comment
Please, Sign In to add comment