Guest User

Untitled

a guest
Feb 26th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. $data = Input::only( array('name', 'password') );
  2. $user = new user( $data );
  3. $validation = $user -> getValidation('login');
  4. if ( $validation -> fails() )
  5. {
  6. $this -> data['state'] = 0;
  7. $this -> data['validationMessages'] = $validation -> messages();
  8. }
  9. else
  10. {
  11. $userInstance = $user -> getUserInstance();
  12. if (! $userInstance )
  13. {
  14. $this -> data['state'] = 1;
  15. $this -> data['message'] = 'Osoba o takiej nazwie nie istnieje!';
  16. }
  17. elseif ( Hash::check($user -> getAttribute('password'), $userInstance -> getAttribute('password')) )
  18. {
  19. $this -> data['state'] = 2;
  20. User::login( $userInstance -> getAttribute('id') );
  21. return Redirect::to('user/profile');
  22. }
  23. else
  24. {
  25. $this -> data['state'] = 3;
  26. $this -> data['message'] = 'Podano złe hasło!';
  27. }
  28. }
  29.  
  30. $this -> layout -> content = View::make('user.loginForm', $this -> data);
Advertisement
Add Comment
Please, Sign In to add comment