44 $ username = $ this ->data ['username ' ] ?? null ;
55 $ forgotPasswordUrl = $ this ->data ['forgotPasswordUrl ' ] ?? null ;
66 $ csrfToken = $ this ->data ['csrfToken ' ] ?? null ;
7+ $ idpName = $ this ->data ['idp_name ' ] ?? '— ' ;
78
89 $ errorCode = $ this ->data ['errorcode ' ] ?? null ;
910 $ errorMessageKey = $ this ->data ['errorparams ' ][1 ] ?? '{material:login:error_wronguserpass} ' ;
2122 <script src='https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit' async defer></script>
2223
2324 <script>
24- function onSubmit () {
25+ function submitForm () {
2526 document.querySelector('form').submit();
2627 }
2728
@@ -30,7 +31,7 @@ function onRecaptchaLoad() {
3031
3132 grecaptcha.render(loginButton, {
3233 sitekey: '<?= htmlentities ($ siteKey ) ?> ',
33- callback: onSubmit
34+ callback: submitForm
3435 });
3536 }
3637 </script>
@@ -39,77 +40,83 @@ function onRecaptchaLoad() {
3940 ?>
4041
4142</head>
42- <body>
43+ <body class="gradient-bg" >
4344<div class="mdl-layout mdl-layout--fixed-header fill-viewport">
44- <header class="mdl-layout__header">
45- <div class="mdl-layout__header-row">
46- <span class="mdl-layout-title">
47- <?= $ this ->t ('{material:login:header} ' ) ?>
48- </span>
49- </div>
50- </header>
45+ <?php include __DIR__ . '/../common-announcement.php ' ?>
5146
5247 <main class="mdl-layout__content">
53- <form method="POST" action="<?= htmlentities ($ _SERVER ['PHP_SELF ' ]) ?> "
54- layout-children="column">
55- <?php include __DIR__ . '/../common-announcement.php ' ?>
56-
57- <input type="hidden" name="AuthState"
58- value="<?= htmlspecialchars ($ this ->data ['stateparams ' ]['AuthState ' ]) ?> " />
59- <input type="hidden" name="csrf-token" value="<?= htmlentities ($ csrfToken ); ?> " />
60-
61- <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
62- <label for="username" class="mdl-textfield__label">
63- <?= $ this ->t ('{material:login:label_username} ' ) ?>
64- </label>
65- <input type="text" name="username" class="mdl-textfield__input"
66- value="<?= htmlspecialchars ($ username ) ?> "
67- <?= empty ($ username ) ? 'autofocus ' : '' ?> />
48+ <div class="mdl-card mdl-shadow--8dp unfix-width">
49+ <div class="mdl-card__media white-bg margin">
50+ <img src="/logo.png" alt="<?= $ this ->t ('{material:login:logo} ' , ['{idpName} ' => $ idpName ]) ?> ">
6851 </div>
6952
70- <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
71- <label for="password" class="mdl-textfield__label">
72- <?= $ this ->t ('{material:login:label_password} ' ) ?>
73- </label>
74- <input type="password" name="password" class="mdl-textfield__input"
75- <?= ! empty ($ username ) ? 'autofocus ' : '' ?> />
53+
54+ <div class="mdl-card__title">
55+ <h1 class="mdl-card__title-text">
56+ <?= $ this ->t ('{material:login:header} ' , ['{idpName} ' => $ idpName ]) ?>
57+ </h1>
7658 </div>
77-
78- <?php
79- if ($ errorCode == 'WRONGUSERPASS ' ) {
80- ?>
81- <p class="mdl-color-text--red" layout-children="row"
82- child-spacing="space-between">
83- <i class="material-icons">error</i>
84-
85- <span class="mdl-textfield mdl-typography--caption margin">
86- <?= $ this ->t ($ errorMessageKey , $ errorMessageTokens ) ?>
87- </span>
88- </p>
89- <?php
90- }
91- ?>
92-
93- <button class="mdl-button mdl-button--colored mdl-button--raised">
94- <?= $ this ->t ('{material:login:button_login} ' ) ?>
95- </button>
96-
97- <?php
98- if (! empty ($ forgotPasswordUrl )) {
99- ?>
100- <p class="mdl-typography--caption margin">
101- <a href="<?= htmlentities ($ forgotPasswordUrl ) ?> "
102- target="_blank">
103- <?= $ this ->t ('{material:login:forgot} ' ) ?>
104- </a>
105- <p>
106- <?php
107- }
108- ?>
109- </form>
59+
60+ <form method="POST" action="<?= htmlentities ($ _SERVER ['PHP_SELF ' ]) ?> "
61+ layout-children="column" class="mdl-card__supporting-text" id="loginform">
62+
63+ <input type="hidden" name="AuthState"
64+ value="<?= htmlspecialchars ($ this ->data ['stateparams ' ]['AuthState ' ]) ?> " />
65+ <input type="hidden" name="csrf-token" value="<?= htmlentities ($ csrfToken ); ?> " />
66+
67+ <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
68+ <label for="username" class="mdl-textfield__label">
69+ <?= $ this ->t ('{material:login:label_username} ' ) ?>
70+ </label>
71+ <input type="text" name="username" class="mdl-textfield__input"
72+ value="<?= htmlspecialchars ($ username ) ?> "
73+ <?= empty ($ username ) ? 'autofocus ' : '' ?> id="username"/>
74+ </div>
75+
76+ <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
77+ <label for="password" class="mdl-textfield__label">
78+ <?= $ this ->t ('{material:login:label_password} ' ) ?>
79+ </label>
80+ <input type="password" name="password" class="mdl-textfield__input"
81+ <?= ! empty ($ username ) ? 'autofocus ' : '' ?> id="password"/>
82+ </div>
83+
84+ <?php
85+ if ($ errorCode == 'WRONGUSERPASS ' ) {
86+ ?>
87+ <p class="mdl-color-text--red" layout-children="row" child-spacing="space-between">
88+ <i class="material-icons">error</i>
89+
90+ <span class="mdl-textfield mdl-typography--caption margin">
91+ <?= $ this ->t ($ errorMessageKey , $ errorMessageTokens ) ?>
92+ </span>
93+ </p>
94+ <?php
95+ }
96+ ?>
97+ </form>
98+
99+ <div class="mdl-card__actions" layout-children="row">
100+ <?php
101+ if (! empty ($ forgotPasswordUrl )) {
102+ ?>
103+ <a href="<?= htmlentities ($ forgotPasswordUrl ) ?> " target="_blank"
104+ class="mdl-typography--caption margin">
105+ <?= $ this ->t ('{material:login:forgot} ' ) ?>
106+ </a>
107+ <?php
108+ }
109+ ?>
110+
111+ <span flex></span>
112+
113+ <button class="mdl-button mdl-button--colored" form="loginform">
114+ <?= $ this ->t ('{material:login:button_login} ' ) ?>
115+ </button>
116+ </div>
117+ </div>
110118 </main>
111119
112- <?php include __DIR__ . '/../common-footer.php ' ?>
113120</div>
114121</body>
115122</html>
0 commit comments