summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/login.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-16 10:06:58 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-16 10:06:58 -0700
commit78ee4193b70329c8e0929efd18c22324dd2ad8e0 (patch)
tree900c686f12934fdf168ebe214afc1cb414bf4683 /modules/gallery/controllers/login.php
parentbc241e44c2e4d10ac19ccc32a40c90426672d963 (diff)
Remove all non Identity API methods from Identity.php. Created an MY_Session class to provide the user state changes in the session and a login.php helper that has the login form.
Diffstat (limited to 'modules/gallery/controllers/login.php')
-rw-r--r--modules/gallery/controllers/login.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/gallery/controllers/login.php b/modules/gallery/controllers/login.php
index c8b771ca..96a97a1d 100644
--- a/modules/gallery/controllers/login.php
+++ b/modules/gallery/controllers/login.php
@@ -21,7 +21,7 @@ class Login_Controller extends Controller {
public function ajax() {
$view = new View("login_ajax.html");
- $view->form = Identity::get_login_form("login/auth_ajax");
+ $view->form = login::get_login_form("login/auth_ajax");
print $view;
}
@@ -40,7 +40,7 @@ class Login_Controller extends Controller {
}
public function html() {
- print Identity::get_login_form("login/auth_html");
+ print login::get_login_form("login/auth_html");
}
public function auth_html() {
@@ -54,7 +54,7 @@ class Login_Controller extends Controller {
}
}
private function _auth($url) {
- $form = Identity::get_login_form($url);
+ $form = login::get_login_form($url);
$valid = $form->validate();
if ($valid) {
$user = Identity::lookup_user_by_name($form->login->inputs["name"]->value);
@@ -69,7 +69,12 @@ class Login_Controller extends Controller {
}
if ($valid) {
- Identity::login($user);
+ if (Identity::is_writable()) {
+ $user->login_count += 1;
+ $user->last_login = time();
+ $user->save();
+ }
+ Session::set_active_user($user);
log::info("user", t("User %name logged in", array("name" => $user->name)));
}