/
login.php
161 lines (141 loc) · 7.86 KB
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
/**
* Login Form
*/
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('login');
?>
<noscript>If you see this you have probably JavaScript deactivated. LimeSurvey does not work without Javascript being activated in the browser!</noscript>
<div class="container-fluid welcome">
<div class="row text-center">
<div id="login-panel">
<div class="panel panel-primary login-panel" id="panel-1">
<!-- Header -->
<div class="panel-body">
<div class="row">
<img alt="logo" id="profile-img" class="profile-img-card center-block" src="<?php echo LOGO_URL;?>" />
<p><?php eT("Administration");?></p>
</div>
</div>
<!-- Action Name -->
<div class="row login-title login-content">
<div class="col-lg-12">
<h3><?php eT("Log in");?></h3>
</div>
</div>
<!-- Form -->
<?php echo CHtml::form(array('admin/authentication/sa/login'), 'post', array('id'=>'loginform', 'name'=>'loginform'));?>
<div class="row login-content login-content-form">
<div class="col-lg-12">
<?php
$pluginNames = array_keys($pluginContent);
if (!isset($defaultAuth))
{
// Make sure we have a default auth, if not set, use the first one we find
$defaultAuth = reset($pluginNames);
}
if (count($pluginContent)>1)
{
$selectedAuth = App()->getRequest()->getParam('authMethod', $defaultAuth);
if (!in_array($selectedAuth, $pluginNames))
{
$selectedAuth = $defaultAuth;
}
?>
<label for='authMethod'><?php eT("Authentication method"); ?></label>
<?php
$possibleAuthMethods = array();
foreach($pluginNames as $plugin)
{
$info = App()->getPluginManager()->getPluginInfo($plugin);
$methodName = call_user_func([$info['pluginClass'], 'getAuthMethodName']);
$possibleAuthMethods[$plugin] = !empty($methodName) ? $methodName : $info['pluginName'];
}
//print_r($possibleAuthMethods); die();
$this->widget('yiiwheels.widgets.select2.WhSelect2', array(
'name' => 'authMethod',
'data' => $possibleAuthMethods,
'value' => $selectedAuth,
'pluginOptions' => array(
'options' => array(
'onChange'=>'this.form.submit();'
)
)));
}
else
{
echo CHtml::hiddenField('authMethod', $defaultAuth);
$selectedAuth = $defaultAuth;
}
if (isset($pluginContent[$selectedAuth]))
{
$blockData = $pluginContent[$selectedAuth];
/* @var $blockData PluginEventContent */
echo $blockData->getContent();
}
$aLangList = getLanguageDataRestricted(true);
$languageData = array();
$reqLang = App()->request->getParam('lang');
if ($reqLang === null){
$languageData['default'] = gT('Default');
}else{
$languageData[$reqLang] = html_entity_decode($aLangList[$reqLang]['nativedescription'], ENT_NOQUOTES, 'UTF-8') . " - " . $aLangList[$reqLang]['description'];
$languageData['default'] = gT('Default');
unset($aLangList[$reqLang]);
}
foreach ( $aLangList as $sLangKey => $aLanguage)
{
$languageData[$sLangKey] = html_entity_decode($aLanguage['nativedescription'], ENT_NOQUOTES, 'UTF-8') . " - " . $aLanguage['description'];
}
echo CHtml::label(gT('Language'), 'loginlang');
$this->widget('yiiwheels.widgets.select2.WhSelect2', array(
'name' => 'loginlang',
'data' => $languageData,
'value' => $language,
'pluginOptions' => array(
'htmlOptions' => array(
'id' => 'loginlang'
),
)
));
?>
<?php if (Yii::app()->getConfig("demoMode") === true && Yii::app()->getConfig("demoModePrefill") === true)
{ ?>
<p><?php eT("Demo mode: Login credentials are prefilled - just click the Login button."); ?></p>
<?php
} ?>
</div>
</div>
<!-- Buttons -->
<div class="row login-submit login-content">
<div class="col-lg-12">
<p><input type='hidden' name='action' value='login' />
<input type='hidden' id='width' name='width' value='' />
<button type="submit" class="btn btn-default" name='login_submit' value='login'><?php eT('Log in');?></button><br />
<br/>
<?php
if (Yii::app()->getConfig("display_user_password_in_email") === true)
{
?>
<a href='<?php echo $this->createUrl("admin/authentication/sa/forgotpassword"); ?>'><?php eT("Forgot your password?"); ?></a><br />
<?php
}
?>
</p>
</div>
</div>
<?php echo CHtml::endForm(); ?>
</div>
</div>
</div>
</div>
<!-- Set focus on user input -->
<script type='text/javascript'>
$( document ).ready(function() {
$('#user').focus();
$("#width").val($(window).width());
});
$( window ).resize(function() {
$("#width").val($(window).width());;
});
</script>