Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 3ee80d1

Browse files
author
Billy Clark
committed
code review feedback
1 parent 4201bb8 commit 3ee80d1

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

themes/material/common-announcement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$announcement = $this->data['announcement'];
2+
$announcement = $this->data['announcement'] ?? null;
33

44
if (! empty($announcement)) {
55
?>

themes/material/core/loginuserpass.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
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

Comments
 (0)