Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = Input::only( array('name', 'password') );
- $user = new user( $data );
- $validation = $user -> getValidation('login');
- if ( $validation -> fails() )
- {
- $this -> data['state'] = 0;
- $this -> data['validationMessages'] = $validation -> messages();
- }
- else
- {
- $userInstance = $user -> getUserInstance();
- if (! $userInstance )
- {
- $this -> data['state'] = 1;
- $this -> data['message'] = 'Osoba o takiej nazwie nie istnieje!';
- }
- elseif ( Hash::check($user -> getAttribute('password'), $userInstance -> getAttribute('password')) )
- {
- $this -> data['state'] = 2;
- User::login( $userInstance -> getAttribute('id') );
- return Redirect::to('user/profile');
- }
- else
- {
- $this -> data['state'] = 3;
- $this -> data['message'] = 'Podano złe hasło!';
- }
- }
- $this -> layout -> content = View::make('user.loginForm', $this -> data);
Advertisement
Add Comment
Please, Sign In to add comment