public function login($base) { $this->userOnly(); $form = new LoginForm(); if ($form->isSubmitted() && $form->validation->validate()) { if ($this->user->authenticate($form->get('username'), $form->get('password'))) { $this->flash('info', 'Welcome back ' . $form->get('username')); $this->refresh(); } $base->set('error', 'Login gagal! Cek kembali username dan password Anda.'); } $base->set('form', $form); $this->render('default/login.html'); }