<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
$user = User::getSilent($login);
- $success = $this->checkPassword($login, $user, Post::v('response'));
-
- if (!is_null($user) && S::suid()) {
- $success = (S::suid('uid') == $user->id());
+ if (is_null($user)) {
+ Platal::page()->trigError(self::TEXT_INVALID_LOGIN);
+ $success = false;
} else {
- $success = $this->checkPassword($login, $user, Post::v('response'));
+ if (S::suid()) {
+ $success = (S::suid('uid') == $user->id());
+ } else {
+ $success = $this->checkPassword($login, $user, Post::v('response'));
+ }
}
if ($success) {
- S::set('auth', AUTH_MDP);
+ S::set('auth', AUTH_PASSWD);
S::kill('challenge');
S::logger($user->id())->log('auth_ok');
}
return true;
}
if ($level == AUTH_SUID) {
- S::set('auth', AUTH_MDP);
+ S::set('auth', AUTH_PASSWD);
}
// Loads uid and hruid into the session for developement conveniance.
$this->setAccessCookie(false, S::i('auth_by_cookie') != $user->id());
} else {
$this->killAccessCookie();
+
+ // If login for an external website and not activating cookie,
+ // mark that we want to disconnect once external auth checks
+ // have been performed.
+ if (Post::b('external_auth')) {
+ S::set('external_auth_exit', true);
+ }
}
}
public function sureLevel()
{
- return AUTH_MDP;
+ return AUTH_PASSWD;
}
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>