@@ -43,12 +43,31 @@ function footer()
43
43
echo $ GLOBALS ['I18N ' ]->get ('Enter your email address ' ).': </p><input type="text" name="forgotpassword" value="" size="30" /> ' ;
44
44
echo ' <input class="submit" type="submit" name="process" value=" ' .$ GLOBALS ['I18N ' ]->get ('Send password ' ).'" /> ' ;
45
45
echo ' <div class="clear"></div> ' ;
46
- if (isset ($ GLOBALS ['plugins ' ]['simplesaml ' ])) {
47
- echo '<a href="?sso" style="display: inline-block; padding: 5px 10px; background-color: #2c2c2c; color: #fff; text-decoration: none; border-radius: 5px; font-size: 16px; text-align: center;"">SSO login</a> ' ;
48
- }
49
46
echo '</div></form> ' ;
50
47
}
51
48
49
+ function renderSSO ()
50
+ {
51
+ if (!empty ($ GLOBALS ['ssoplugin ' ])) {
52
+ echo '<form method="post" id="forgotpassword-form" action=""> ' ;
53
+ echo '<div style="display: flex; justify-content: space-around; align-items: center;"> ' ;
54
+
55
+ foreach ($ GLOBALS ['ssoplugin ' ] as $ plugin ) {
56
+ $ ssoUrl = $ GLOBALS ['plugins ' ][$ plugin ]->autUrl ;
57
+ $ buttonText = 'Login with ' . $ GLOBALS ['plugins ' ][$ plugin ]->settings ['display_name ' ]['value ' ];
58
+
59
+ echo '<a href="? ' . $ ssoUrl . '"
60
+ style="display: inline-block; padding: 8px 15px; background-color: #3c3c3c; color: #fff;
61
+ text-decoration: none; border-radius: 5px; font-size: 16px; text-align: center;
62
+ min-width: 120px;">
63
+ ' . $ buttonText . '
64
+ </a> ' ;
65
+ }
66
+
67
+ echo '</div> ' ;
68
+ echo '</form> ' ;
69
+ }
70
+ }
52
71
//Delete from the DB every token older than certain elapsed time.
53
72
function deleteOldTokens ()
54
73
{
@@ -119,16 +138,20 @@ function deleteOldTokens()
119
138
exit ;
120
139
}
121
140
} else {
122
- echo "<form method= \"post \" id= \"login-form \" action= \"\"> \n" ;
123
- echo " <input type= \"hidden \" name= \"page \" value= \"$ page \" /> \n" ;
124
- echo " <table class= \"loginPassUpdate \" width= \"100% \" border= \"0 \" cellpadding= \"2 \" cellspacing= \"0 \"> \n" ;
125
- echo ' <tr><td><span class="general"> ' .$ GLOBALS ['I18N ' ]->get ('Name ' ).":</span></td></tr> \n" ;
126
- echo ' <tr><td><input type="text" name="login" value="" size="30" autofocus="autofocus" /></td></tr> ' ;
127
- echo ' <tr><td><span class="general"> ' .$ GLOBALS ['I18N ' ]->get ('Password ' ).':</span></td></tr> ' ;
128
- echo ' <tr><td><input type="password" name="password" value="" size="30" /></td></tr> ' ;
129
- echo ' <tr><td><input class="submit" type="submit" name="process" value=" ' .$ GLOBALS ['I18N ' ]->get ('Continue ' ).'" /></td></tr> ' ;
130
- echo ' </table> ' ;
131
- echo '</form> ' ;
132
- footer ();
141
+ $ showDefaultLogin = !isset ($ GLOBALS ['ssoplugin ' ]) || !getConfig ('hide_default_login ' );
142
+ if ($ showDefaultLogin ) {
143
+ echo "<form method= \"post \" id= \"login-form \" action= \"\"> \n" ;
144
+ echo " <input type= \"hidden \" name= \"page \" value= \"$ page \" /> \n" ;
145
+ echo " <table class= \"loginPassUpdate \" width= \"100% \" border= \"0 \" cellpadding= \"2 \" cellspacing= \"0 \"> \n" ;
146
+ echo ' <tr><td><span class="general"> ' .$ GLOBALS ['I18N ' ]->get ('Name ' ).":</span></td></tr> \n" ;
147
+ echo ' <tr><td><input type="text" name="login" value="" size="30" autofocus="autofocus" /></td></tr> ' ;
148
+ echo ' <tr><td><span class="general"> ' .$ GLOBALS ['I18N ' ]->get ('Password ' ).':</span></td></tr> ' ;
149
+ echo ' <tr><td><input type="password" name="password" value="" size="30" /></td></tr> ' ;
150
+ echo ' <tr><td><input class="submit" type="submit" name="process" value=" ' .$ GLOBALS ['I18N ' ]->get ('Continue ' ).'" /></td></tr> ' ;
151
+ echo ' </table> ' ;
152
+ echo '</form> ' ;
153
+ footer ();
154
+ }
155
+ renderSSO ();
133
156
}
134
157
?>
0 commit comments