Guest User

Untitled

a guest
Aug 27th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. kohana2 auth - login problem
  2. ORM::factory('user', $post['username'])
  3.  
  4. <?php
  5. // grab relevant $_POST data
  6. $username = $this->input->post('username');
  7. $password = $this->input->post('password');
  8.  
  9. // instantiate User_Model and set attributes to the $_POST data
  10. $user = ORM::factory('user');
  11. $user->username = $username;
  12. $user->password = Auth::instance()->hash_password($password);
  13.  
  14. // if the user was successfully created...
  15. if ($user->add(ORM::factory('role', 'login')) AND $user->save()) {
  16.  
  17. // login using the collected data
  18. Auth::instance()->login($username, $password);
  19.  
  20. // redirect to somewhere
  21. url::redirect('user/profile');
  22. }
Add Comment
Please, Sign In to add comment