/
oauth-login.mako
273 lines (238 loc) · 8.23 KB
/
oauth-login.mako
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
## Licensed to Cloudera, Inc. under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. Cloudera, Inc. licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
<%!
import sys
from desktop import conf
if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import ugettext as _
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
%if first_login_ever:
<title>${_('Hue - Sign up')}</title>
%else:
<title>${_('Hue - Sign in')}</title>
%endif
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="${ static('desktop/ext/css/cui/cui.css') }" rel="stylesheet">
<link href="${ static('desktop/ext/css/cui/bootstrap2.css') }" rel="stylesheet">
<link href="${ static('desktop/ext/css/cui/bootstrap-responsive2.css') }" rel="stylesheet">
<link href="${ static('desktop/ext/css/font-awesome.min.css') }" rel="stylesheet">
<link href="${ static('desktop/css/hue3.css') }" rel="stylesheet">
<link href="${ static('desktop/css/hue3-extra.css') }" rel="stylesheet">
<style type="text/css">
body {
padding-top: 80px;
}
#logo {
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 30px
}
.login-content {
width: 400px;
display: block;
margin-left: auto;
margin-right: auto;
}
.login-content label {
margin-bottom: 20px;
font-size: 16px;
}
.login-content input[type='text'], .login-content input[type='password'] {
width: 90%;
margin-top: 10px;
font-size: 18px;
}
.login-content input {
width: 100%;
padding: 10px 16px;
}
hr {
border-top-color: #DEDEDE;
}
ul.errorlist li {
font-size: 13px;
font-weight: normal;
font-style: normal;
}
input.error {
border-color: #b94a48;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.well {
border: 1px solid #D8D8D8;
border-radius: 3px 3px 3px 3px;
}
.footer {
position: fixed;
bottom: 0;
background-color: #0B7FAD;
height: 4px;
width: 100%;
}
.btn.btn-large {
min-width: 38%;
margin: 8px 0 0 0;
text-align: left;
/*......added from here......*/
min-height: 0;
height: auto;
}
.icons-only {
text-align: center;
}
.icons-only .btn.btn-large img {
margin-right: 0;
}
.icons-only .btn.btn-large span {
display: none;
text-align: center;
}
.icons-only .btn.btn-large {
min-width: 32px;
text-align: center;
}
.login-content h3 {
text-align: center;
margin: 0 0 -25px;
font-size: 18px;
color: silver;
}
</style>
</head>
<body>
<div class="footer"></div>
<div class="navigator">
<a class="brand nav-tooltip pull-left" href="#">
<img src="${ static('desktop/art/hue-logo-mini-white.png') }" alt="${ _('Hue logo') }"
data-orig="${ static('desktop/art/hue-logo-mini-white.png') }"
data-hover="${ static('desktop/art/hue-logo-mini-white-hover.png') }"/>
</a>
<ul class="nav nav-pills pull-left hide" id="visit">
<li><a title="${_('Visit gethue.com')}" href="http://gethue.com">${_('Fell asleep? Visit us on gethue.com instead!')} <i class="fa fa-external-link-circle"></i></a></li>
</ul>
</div>
<div class="container">
<div class="row">
<div class="login-content">
<form method="POST" action="${action}" class="well">
${ csrf_token(request) | n,unicode }
<img id="logo" src="${ static('desktop/art/hue-login-logo.png') }" data-orig="${ static('desktop/art/hue-login-logo.png') }"
data-hover="${ static('desktop/art/hue-login-logo-skew.png') }" alt="${ _('Hue logo') }"/>
%if login_errors:
<div class="alert alert-error" style="text-align: center">
<strong><i class="fa fa-exclamation-triangle"></i> ${_('Error!')}</strong> ${_('Invalid username or password.')}
</div>
%endif
%if first_login_ever:
<div class="alert alert-block">
<i class="fa fa-exclamation-triangle"></i>
${_('This is your first time logging in.')}
<strong>${_('You will become Hue superuser.')}</strong>.
</div>
<h3>${_('Sign Up via')}</h3>
<hr/>
%else:
<h3>${_('Sign In via')}</h3>
<hr/>
%endif
<div id="buttons_group" class="buttons-group">
%if socialGoogle:
<span class="btn btn-large btn-primary google">
<img src="${ static('liboauth/art/icon-gplus.png') }" alt="${ _('Google icon') }">
<span>Google</span>
</span>
%endif
%if socialFacebook:
<span class="btn btn-large btn-primary facebook">
<img src="${ static('liboauth/art/icon-fb.png') }" alt="${ _('Facebook icon') }">
<span>Facebook</span>
</span>
%endif
%if socialLinkedin:
<span class="btn btn-large btn-primary linkedin">
<img src="${ static('liboauth/art/icon-linkedin.png') }" alt="${ _('Linkedin icon') }">
<span>Linkedin</span>
</span>
%endif
%if socialTwitter:
<span class="btn btn-large btn-primary twitter">
<img src="${ static('liboauth/art/icon-twitter.png') }" alt="${ _('Twitter icon') }">
<span>Twitter</span>
</span>
%endif
%if not socialGoogle and not socialFacebook and not socialLinkedin and not socialTwitter:
${ _('The oauth app is not configured with any provider.') }
% endif
</div>
<input type="hidden" name="next" value="${next}"/>
</form>
</div>
</div>
</div>
<script src="${ static('desktop/ext/js/jquery/jquery-3.5.1.min.js') }"></script>
<script>
var $buttonsGroup = $("#buttons_group");
if($buttonsGroup.children().length > 2) {
$buttonsGroup.addClass("icons-only");
}
$(document).ready(function () {
var _skew = -1;
$("[data-hover]").on("mouseover", function () {
var _this = $(this);
_skew = window.setTimeout(function () {
_this.attr("src", _this.data("hover"));
$("#visit").removeClass("hide");
}, 3000);
});
$("[data-hover]").on("mouseout", function () {
$(this).attr("src", $(this).data("orig"));
window.clearTimeout(_skew);
});
$("input").css({"display": "block", "margin-left": "auto", "margin-right": "auto"});
$("span.google").on('click', function () {
window.location.replace('/oauth/social_login/oauth?social=google');
return false;
});
$("span.facebook").on('click', function () {
window.location.replace('/oauth/social_login/oauth?social=facebook');
return false;
});
$("span.linkedin").on('click', function () {
window.location.replace('/oauth/social_login/oauth?social=linkedin');
return false;
});
$("span.twitter").on('click', function () {
window.location.replace('/oauth/social_login/oauth?social=twitter');
return false;
});
$("ul.errorlist").each(function () {
$(this).prev().addClass("error");
});
});
</script>
</body>
</html>