11<!DOCTYPE html>
2+ <?php
3+ $ siteKey = $ this ->data ['recaptcha.siteKey ' ] ?? null ;
4+ $ errorCode = $ this ->data ['errorcode ' ] ?? null ;
5+ $ username = $ this ->data ['username ' ] ?? null ;
6+ ?>
27<html>
38<head>
49 <title><?= $ this ->t ('{material:login:title} ' ) ?> </title>
510
611 <?php include __DIR__ . '/../common-head-elements.php ' ?>
712
813 <?php
9- $ key = $ this ->data ['recaptcha.siteKey ' ];
10- if ($ this ->data ['errorcode ' ] == 'RECAPTCHA_REQUIRED ' && ! empty ($ key )) {
14+ if ($ errorCode == 'RECAPTCHA_REQUIRED ' && ! empty ($ siteKey )) {
1115 ?>
1216 <script src='https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit' async defer></script>
1317
@@ -20,7 +24,7 @@ function onRecaptchaLoad() {
2024 var loginButton = document.querySelector('button');
2125
2226 grecaptcha.render(loginButton, {
23- sitekey: $key ,
27+ sitekey: $siteKey ,
2428 callback: onSubmit
2529 });
2630 }
@@ -53,20 +57,20 @@ function onRecaptchaLoad() {
5357 <?= $ this ->t ('{material:login:label_username} ' ) ?>
5458 </label>
5559 <input type="text" name="username" class="mdl-textfield__input"
56- value="<?= htmlspecialchars ($ this -> data [ ' username ' ] ) ?> "
57- <?= empty ($ this -> data [ ' username ' ] ) ? 'autofocus ' : '' ?> />
60+ value="<?= htmlspecialchars ($ username ) ?> "
61+ <?= empty ($ username ) ? 'autofocus ' : '' ?> />
5862 </div>
5963
6064 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
6165 <label for="password" class="mdl-textfield__label">
6266 <?= $ this ->t ('{material:login:label_password} ' ) ?>
6367 </label>
6468 <input type="password" name="password" class="mdl-textfield__input"
65- <?= ! empty ($ this -> data [ ' username ' ] ) ? 'autofocus ' : '' ?> />
69+ <?= ! empty ($ username ) ? 'autofocus ' : '' ?> />
6670 </div>
6771
6872 <?php
69- if ($ this -> data [ ' errorcode ' ] == 'WRONGUSERPASS ' ) {
73+ if ($ errorCode == 'WRONGUSERPASS ' ) {
7074 ?>
7175 <p class="mdl-color-text--red" layout-children="row"
7276 child-spacing="space-between">
0 commit comments