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,10 +21,12 @@ 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 }
28+
29+ ga('send', 'event', 'reCAPTCHA', 'required');
3830 </script>
3931 <?php
4032 }
@@ -45,12 +37,19 @@ function onRecaptchaLoad() {
4537 <main class="mdl-layout__content" layout-children="column" child-spacing="center">
4638 <?php include __DIR__ . '/../common-announcement.php ' ?>
4739
40+
4841 <form method="POST" action="<?= htmlentities ($ _SERVER ['PHP_SELF ' ]) ?> ">
4942 <input type="hidden" name="AuthState"
50- value="<?= htmlspecialchars ($ this ->data ['stateparams ' ]['AuthState ' ]) ?> " />
51- <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 ?> " />
5248
5349 <div class="mdl-card mdl-shadow--8dp">
50+ <?php
51+ $ idpName = htmlentities ($ this ->configuration ->getValue ('idp_name ' , '— ' ));
52+ ?>
5453 <div class="mdl-card__media white-bg margin" layout-children="column">
5554 <img src="/logo.png"
5655 alt="<?= $ this ->t ('{material:login:logo} ' , ['{idpName} ' => $ idpName ]) ?> ">
@@ -67,8 +66,11 @@ function onRecaptchaLoad() {
6766 <label for="username" class="mdl-textfield__label">
6867 <?= $ this ->t ('{material:login:label_username} ' ) ?>
6968 </label>
69+ <?php
70+ $ username = htmlentities ($ this ->data ['username ' ] ?? null );
71+ ?>
7072 <input type="text" name="username" class="mdl-textfield__input"
71- value="<?= htmlspecialchars ( $ username) ?> "
73+ value="<?= $ username ?> "
7274 <?= empty ($ username ) ? 'autofocus ' : '' ?> id="username"/>
7375 </div>
7476
@@ -82,24 +84,34 @@ function onRecaptchaLoad() {
8284 </div>
8385
8486 <?php
87+ $ errorCode = htmlentities ($ this ->data ['errorcode ' ]);
8588 if ($ errorCode == 'WRONGUSERPASS ' ) {
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 ));
8693 ?>
87- <p class="mdl-color-text--red error">
88- <i class="material-icons">error</i>
94+ <p class="mdl-color-text--red error">
95+ <i class="material-icons">error</i>
96+
97+ <span class="mdl-textfield mdl-typography--caption">
98+ <?= $ message ?>
99+ </span>
100+ </p>
89101
90- <span class="mdl-textfield mdl-typography--caption">
91- <?= $ this ->t ($ errorMessageKey , $ errorMessageTokens ) ?>
92- </span>
93- </p>
102+ <script>
103+ ga('send','event','error','<?= $ errorCode ?> ','<?= $ username ?> ','<?= $ message ?> ');
104+ </script>
94105 <?php
95106 }
96107 ?>
97108
98109 <div class="mdl-card__actions" layout-children="row">
99110 <?php
111+ $ forgotPasswordUrl = htmlentities ($ this ->data ['forgotPasswordUrl ' ] ?? null );
100112 if (! empty ($ forgotPasswordUrl )) {
101113 ?>
102- <a href="<?= htmlentities ( $ forgotPasswordUrl) ?> " target="_blank"
114+ <a href="<?= $ forgotPasswordUrl ?> " target="_blank"
103115 class="mdl-button mdl-button--colored mdl-typography--caption">
104116 <?= $ this ->t ('{material:login:forgot} ' ) ?>
105117 </a>
0 commit comments