Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kohana2 auth - login problem
- ORM::factory('user', $post['username'])
- <?php
- // grab relevant $_POST data
- $username = $this->input->post('username');
- $password = $this->input->post('password');
- // instantiate User_Model and set attributes to the $_POST data
- $user = ORM::factory('user');
- $user->username = $username;
- $user->password = Auth::instance()->hash_password($password);
- // if the user was successfully created...
- if ($user->add(ORM::factory('role', 'login')) AND $user->save()) {
- // login using the collected data
- Auth::instance()->login($username, $password);
- // redirect to somewhere
- url::redirect('user/profile');
- }
Add Comment
Please, Sign In to add comment