11<!DOCTYPE html>
2- <?php
3- $ siteKey = $ this ->data ['recaptcha.siteKey ' ] ?? null ;
4- $ username = $ this ->data ['username ' ] ?? null ;
5- $ forgotPasswordUrl = $ this ->data ['forgotPasswordUrl ' ] ?? null ;
6- $ csrfToken = $ this ->data ['csrfToken ' ] ?? null ;
7- $ idpName = $ this ->configuration ->getValue ('idp_name ' , '— ' );
8-
9- $ errorCode = $ this ->data ['errorcode ' ] ?? null ;
10- $ errorMessageKey = $ this ->data ['errorparams ' ][1 ] ?? '{material:login:error_wronguserpass} ' ;
11- $ errorMessageTokens = $ this ->data ['errorparams ' ][2 ] ?? [];
12- ?>
132<html>
143<head>
154 <title><?= $ this ->t ('{material:login:title} ' ) ?> </title>
165
176 <?php include __DIR__ . '/../common-head-elements.php ' ?>
187
198 <?php
9+ $ siteKey = htmlentities ($ this ->data ['recaptcha.siteKey ' ] ?? null );
2010 if (! empty ($ siteKey )) {
2111 ?>
2212 <script src='https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit'
@@ -31,7 +21,7 @@ function onRecaptchaLoad() {
3121 var loginButton = document.querySelector('button');
3222
3323 grecaptcha.render(loginButton, {
34- sitekey: '<?= htmlentities ( $ siteKey) ?> ',
24+ sitekey: '<?= $ siteKey ?> ',
3525 callback: submitForm
3626 });
3727 }
@@ -47,12 +37,19 @@ function onRecaptchaLoad() {
4737 <main class="mdl-layout__content" layout-children="column" child-spacing="center">
4838 <?php include __DIR__ . '/../common-announcement.php ' ?>
4939
40+
5041 <form method="POST" action="<?= htmlentities ($ _SERVER ['PHP_SELF ' ]) ?> ">
5142 <input type="hidden" name="AuthState"
52- value="<?= htmlspecialchars ($ this ->data ['stateparams ' ]['AuthState ' ]) ?> " />
53- <input type="hidden" name="csrf-token" value="<?= htmlentities ($ csrfToken ); ?> " />
43+ value="<?= htmlentities ($ this ->data ['stateparams ' ]['AuthState ' ] ?? null ) ?> " />
44+ <?php
45+ $ csrfToken = htmlentities ($ this ->data ['csrfToken ' ] ?? null );
46+ ?>
47+ <input type="hidden" name="csrf-token" value="<?= $ csrfToken ?> " />
5448
5549 <div class="mdl-card mdl-shadow--8dp fill-phone-viewport">
50+ <?php
51+ $ idpName = htmlentities ($ this ->configuration ->getValue ('idp_name ' , '— ' ));
52+ ?>
5653 <div class="mdl-card__media white-bg margin" layout-children="column">
5754 <img src="/logo.png"
5855 alt="<?= $ this ->t ('{material:login:logo} ' , ['{idpName} ' => $ idpName ]) ?> ">
@@ -69,8 +66,11 @@ function onRecaptchaLoad() {
6966 <label for="username" class="mdl-textfield__label">
7067 <?= $ this ->t ('{material:login:label_username} ' ) ?>
7168 </label>
69+ <?php
70+ $ username = htmlentities ($ this ->data ['username ' ] ?? null );
71+ ?>
7272 <input type="text" name="username" class="mdl-textfield__input"
73- value="<?= htmlspecialchars ( $ username) ?> "
73+ value="<?= $ username ?> "
7474 <?= empty ($ username ) ? 'autofocus ' : '' ?> id="username"/>
7575 </div>
7676
@@ -84,8 +84,12 @@ function onRecaptchaLoad() {
8484 </div>
8585
8686 <?php
87+ $ errorCode = htmlentities ($ this ->data ['errorcode ' ]);
8788 if ($ errorCode == 'WRONGUSERPASS ' ) {
88- $ message = $ this ->t ($ errorMessageKey , $ errorMessageTokens );
89+ $ errorMessageKey = $ this ->data ['errorparams ' ][1 ] ?? '{material:login:error_wronguserpass} ' ;
90+ $ errorMessageTokens = $ this ->data ['errorparams ' ][2 ] ?? null ;
91+
92+ $ message = htmlentities ($ this ->t ($ errorMessageKey , $ errorMessageTokens ));
8993 ?>
9094 <p class="mdl-color-text--red error">
9195 <i class="material-icons">error</i>
@@ -104,9 +108,10 @@ function onRecaptchaLoad() {
104108
105109 <div class="mdl-card__actions" layout-children="row">
106110 <?php
111+ $ forgotPasswordUrl = htmlentities ($ this ->data ['forgotPasswordUrl ' ] ?? null );
107112 if (! empty ($ forgotPasswordUrl )) {
108113 ?>
109- <a href="<?= htmlentities ( $ forgotPasswordUrl) ?> " target="_blank"
114+ <a href="<?= $ forgotPasswordUrl ?> " target="_blank"
110115 class="mdl-button mdl-button--colored mdl-typography--caption">
111116 <?= $ this ->t ('{material:login:forgot} ' ) ?>
112117 </a>
0 commit comments