-
Notifications
You must be signed in to change notification settings - Fork 615
/
login.html
131 lines (113 loc) · 4.62 KB
/
login.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% extends "_layouts/basecp" %}
{% import "_includes/forms" as forms %}
{% set title = "Login"|t('app') %}
{% set bodyClass = 'login' %}
{% do view.registerAssetBundle("craft\\web\\assets\\login\\LoginAsset") %}
{% set username = craft.app.config.general.rememberUsernameDuration ? craft.app.user.getRememberedUsername(): '' %}
{% set showRememberMe = craft.app.config.general.rememberedUserSessionDuration %}
{% if craft.app.config.general.useEmailAsUsername %}
{% set usernameLabel = 'Email'|t('app') %}
{% set usernameType = 'email' %}
{% else %}
{% set usernameLabel = 'Username or Email'|t('app') %}
{% set usernameType = 'text' %}
{% endif %}
{% set hasLogo = CraftEdition == CraftPro and craft.rebrand.isLogoUploaded %}
{% set formAttributes = {
id: 'login-form',
method: 'post',
class: showRememberMe ? 'remember-me' : '',
'accept-charset': 'UTF-8',
} %}
{% if hasLogo %}
{% set logo = craft.rebrand.logo %}
{% endif %}
{% set formHtml %}
<main>
<div id="login">
<h1>
{% if hasLogo %}
{{ tag('img', {
id: 'login-logo',
src: logo.url,
alt: systemName,
width: logo.width,
height: logo.height,
}) }}
{% else %}
{{ systemName }}
{% endif %}
</h1>
<form {{ attr(formAttributes) }}>
<div id="login-form-top">
{{ forms.textField({
id: 'loginName',
name: 'username',
placeholder: usernameLabel,
value: username,
autocomplete: 'username',
type: usernameType,
inputAttributes: {
aria: {
label: usernameLabel,
required: 'true',
},
},
}) }}
{{ forms.passwordField({
id: 'password',
name: 'password',
placeholder: 'Password'|t('app'),
autocomplete: 'current-password',
inputAttributes: {
aria: {
label: 'Password'|t('app'),
required: 'true',
},
},
}) }}
</div>
<div id="login-form-bottom">
{% if showRememberMe %}
{{ forms.checkboxField({ id: 'rememberMe', label: 'Keep me logged in'|t('app') }) }}
{% endif %}
<button id="forgot-password" type="button">{{ 'Forgot your password?'|t('app') }}</button>
<button id="remember-password" type="button">{{ 'Remember your password?'|t('app') }}</button>
</div>
<div class="buttons">
<button id="submit" class="btn submit" type="submit">{{ 'Login'|t('app') }}</button>
<div id="spinner" class="spinner hidden"></div>
</div>
</form>
<div id="login-errors" role="alert">
</div>
<a id="poweredby" href="http://craftcms.com/" title="{{ 'Powered by Craft CMS'|t('app') }}" aria-label="{{ 'Powered by Craft CMS'|t('app') }}">
{{ svg('@app/web/assets/cp/dist/images/craftcms.svg') }}
</a>
</div>
</main>
{% endset %}
{% set noCookiesHtml %}
<main>
<div class="message-container no-access">
<div class="pane notice">
<p>{{ 'Cookies must be enabled to access the Craft CMS control panel.'|t('app') }}</p>
</div>
</div>
</main>
{% endset %}
{% block body %}
<script type="text/javascript">
var cookieTest = 'CraftCookieTest='+Math.floor(Math.random() * 1000000);
document.cookie = cookieTest;
if (document.cookie.search(cookieTest) != -1) {
document.cookie = cookieTest + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
document.write({{ formHtml|json_encode|raw }});
{% if not craft.app.request.isMobileBrowser(true) %}
document.getElementById("{{ (username ? 'password' : 'loginName') }}").focus();
{% endif %}
} else {
document.write({{ noCookiesHtml|json_encode|raw }});
}
</script>
{% endblock %}