Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login() {
- $this->template->title = 'Logowanie :: photowall.me';
- //Check if already logged in
- if (Auth::instance()->logged_in('login')) {
- url::redirect('index');
- } else if (Auth::instance()->logged_in()) {
- url::redirect('accessdenied'); //User hasn't confirmed account yet
- }
- //Initialize template and form fields
- $this->template->content = new View('user/login');
- $this->template->content->username = '';
- $view->template->content->password = '';
- //Attempt login if form was submitted
- if ($post = $this->input->post()) {
- if (ORM::factory('user')->login($post)) {
- url::redirect('panel/projects');
- } else {
- die(print_r($post->errors()));
- $this->template->content->username = $post['username']; //Redisplay username (but not password) when form is redisplayed.
- $view->template->content->message = in_array('required', $post->errors()) ? 'Username and password are required.' : 'Invalid username and/or password.';
- }
- }
- //Display login form
- #$view->render(TRUE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement