public function action_login() { $data["subnav"] = array('login' => 'active'); $auth = Auth::instance(); if (Auth::instance()->check()) { Session::set_flash('success', 'You are already logged in, ' . $auth->get_screen_name()); Response::redirect('/admin'); } $view = View::forge('admin/users/login', $data); $form = Form::forge('login'); $form->add('username', 'Username:'******'class' => 'form-control')); $form->add('password', 'Password:'******'type' => 'password', 'class' => 'form-control')); $form->add('submit', ' ', array('type' => 'submit', 'value' => 'Login', 'class' => 'btn btn-primary')); if (Input::post()) { if ($auth->login(Input::post('username'), Input::post('password'))) { Session::set_flash('success', 'Successfully logged in! Welcome ' . $auth->get_screen_name()); Response::redirect('/'); } else { Session::set_flash('error', 'Username or password incorrect.'); } } $view->set('form', $form, false); $this->template->title = 'User » Login'; $this->template->content = $view; }
public function action_login() { $view = View::forge('users/login'); $form = Form::forge('login'); $auth = Auth::instance(); $form->add('username', 'Username:'******'password', 'Password:'******'type' => 'password')); $form->add('submit', ' ', array('type' => 'submit', 'value' => 'Login')); if (Input::post()) { if ($auth->login(Input::post('username'), Input::post('password'))) { Session::set_flash('success', 'Successfully logged in! Welcome ' . $auth->get_screen_name()); Response::redirect('messages/'); } else { Session::set_flash('error', 'Username or password incorrect.'); } } $view->set('form', $form, false); $this->template->title = 'User » Login'; $this->template->content = $view; }
/** * Get related Form instance or create it * * @param bool|Form * @return Form */ public function form($instance = true) { if ($instance instanceof Form) { $this->form = $instance; return $instance; } if (empty($this->form) and $instance === true) { $this->form = \Form::forge($this); } return $this->form; }
/** * Get related Form instance or create it * * @param bool|Form * @return Form */ public function form($instance = true) { return \Form::forge(); }