From a04ecbde778decfdea7200806a6b1144861ae05f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 19 Apr 2014 22:12:12 -0400 Subject: Add RememberMe feature and authentications history --- controllers/user.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'controllers/user.php') diff --git a/controllers/user.php b/controllers/user.php index bc5c48fe..9e964a4e 100644 --- a/controllers/user.php +++ b/controllers/user.php @@ -32,6 +32,7 @@ class User extends Base */ public function logout() { + $this->rememberMe->destroy($this->acl->getUserId()); $this->session->close(); $this->response->redirect('?controller=user&action=login'); } @@ -63,7 +64,17 @@ class User extends Base $values = $this->request->getValues(); list($valid, $errors) = $this->user->validateLogin($values); - if ($valid) $this->response->redirect('?controller=app'); + if ($valid) { + + $this->lastLogin->create( + \Model\LastLogin::AUTH_DATABASE, + $this->acl->getUserId(), + $this->user->getIpAddress(), + $this->user->getUserAgent() + ); + + $this->response->redirect('?controller=app'); + } $this->response->html($this->template->layout('user_login', array( 'errors' => $errors, -- cgit v1.2.3