32 return _(
'HTML form');
35 static function init ()
40 foreach (static::$secondFactorMethods as $secondFactorMethod) {
44 $secondFactorMethod::init();
51 global $smarty, $config, $message;
55 $smarty->assign(
'focusfield',
'username');
57 if (($_SERVER[
'REQUEST_METHOD'] ==
'POST') && isset($_POST[
'login']) && isset($_POST[
'username']) && isset($_POST[
'password'])) {
58 static::$username = $_POST[
'username'];
59 static::$password = $_POST[
'password'];
61 $success = static::runSteps([
63 'checkForLockingBranch',
65 'loginAndCheckExpired',
71 $secondFactor = FALSE;
72 foreach (static::$secondFactorMethods as $secondFactorMethod) {
76 $secondFactor = ($secondFactorMethod::hasSecondFactor() || $secondFactor);
79 static::redirectSecondFactorPage();
87 static::displayLogin();
94 header(
'Location: secondfactor.php');
101 global $smarty,$message,$config,$ssl,$error_collector,$error_collector_mailto;
105 error_reporting(E_ALL | E_STRICT);
109 if (isset($_POST[
'username'])) {
110 $username = trim($_POST[
'username']);
112 $smarty->assign(
'date', gmdate(
'D, d M Y H:i:s'));
113 $smarty->assign(
'username', $username);
116 $smarty->assign(
'title', _(
'Sign in'));
119 if (!isset($message)) {
122 $smarty->assign(
'message', $message);
125 if (($ssl !=
'') && ($config->get_cfg_value(
'warnSSL') ==
'TRUE')) {
126 $smarty->assign(
'ssl', sprintf(
htmlescape(_(
'Warning: %sSession is not encrypted!%s')),
'<a href="'.$ssl.
'">',
'</a>'));
128 $smarty->assign(
'ssl',
'');
131 if (!$config->check_session_lifetime()) {
132 $smarty->assign(
'lifetime', _(
'Warning: The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.'));
134 $smarty->assign(
'lifetime',
'');
139 if (isset($_POST[
'server'])) {
140 $selected = $_POST[
'server'];
142 $selected = $config->data[
'MAIN'][
'DEFAULT'];
144 foreach ($config->data[
'LOCATIONS'] as $key => $ignored) {
145 $servers[$key] = $key;
147 $smarty->assign(
'server_options', $servers);
148 $smarty->assign(
'server_id', $selected);
151 $smarty->assign(
'PHPSESSID', session_id());
152 if ($error_collector !=
'') {
153 $smarty->assign(
'php_errors', preg_replace(
'/%BUGBODY%/', $error_collector_mailto, $error_collector).
'</div>');
155 $smarty->assign(
'php_errors',
'');
158 $smarty->assign(
'usePrototype',
'false');
159 $smarty->assign(
'date', date(
'l, dS F Y H:i:s O'));
160 $smarty->assign(
'lang', preg_replace(
'/_.*$/',
'', $lang));
173 global $smarty,$message,$config,$ssl,$error_collector,$error_collector_mailto;
177 error_reporting(E_ALL | E_STRICT);
181 if (isset($_POST[
'username'])) {
182 $username = trim($_POST[
'username']);
184 $smarty->assign(
'date', gmdate(
'D, d M Y H:i:s'));
185 $smarty->assign(
'username', $username);
188 $smarty->assign(
'title', _(
'Second factor'));
191 if (!isset($message)) {
194 $smarty->assign(
'message', $message);
197 $smarty->assign(
'PHPSESSID', session_id());
198 if ($error_collector !=
'') {
199 $smarty->assign(
'php_errors', preg_replace(
'/%BUGBODY%/', $error_collector_mailto, $error_collector).
'</div>');
201 $smarty->assign(
'php_errors',
'');
204 $smarty->assign(
'usePrototype',
'false');
205 $smarty->assign(
'date', date(
'l, dS F Y H:i:s O'));
206 $smarty->assign(
'lang', preg_replace(
'/_.*$/',
'', $lang));
208 $smarty->assign(
'CSRFtoken', CSRFProtection::getToken());
213 foreach (static::$secondFactorMethods as $secondFactorMethod) {
217 $methodOutput = $secondFactorMethod::execute();
218 if ($methodOutput !== NULL) {
219 $methodOutputs[$secondFactorMethod] = $methodOutput;
223 $smarty->assign(
'methodOutputs', $methodOutputs);
const FD_VERSION
FusionDirectory Version.
htmlescape(string $str)
Escape string for HTML output.
static redirectSecondFactorPage()
Redirect to the second factor page.
get_template_path($filename='', $plugin=FALSE, $path='')
Return themed path for specified base file.
static get($name)
Accessor of a session var.
static get_dialogs()
Accessor of the message dialog rendered HTML.
static loginProcess()
All login steps in the right order for standard POST login.
static $secondFactorMethods
List of second factor methods, may be dynamic later.
Base class for login methods.
copynotice()
Return HTML safe copyright notice.
static displaySecondFactorPage()
Display the second factor page and exit()
static un_set($name)
Unset a session.
static displayLogin()
Display the login page and exit()
static getLabel()
Displayed name.
static isRTL($lang)
Returns TRUE if $lang is a right to left language.
class_available($name)
Checks if a class is available.