Skip to content

Commit d901724

Browse files
authored
Merge pull request #7 from leozhang2018/move-login-page
Change user login page into dex.
2 parents 8996fa1 + 57be8fb commit d901724

File tree

11 files changed

+461
-126
lines changed

11 files changed

+461
-126
lines changed
File renamed without changes.

custom-web/static/main.css renamed to custom-web/static/css/main.css

Lines changed: 89 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ a {
2929
}
3030

3131
.bottom {
32-
display: flex;
33-
align-items: center;
34-
float: right;
32+
width: 100%;
33+
display: block;
34+
align-items: right;
35+
text-align: right;
36+
margin-top: 5px;
3537
padding: 0 10px;
3638
}
3739

@@ -67,7 +69,7 @@ a {
6769
min-height: 100vh;
6870
padding: 30px 30px;
6971
text-align: left;
70-
background: rgba(0, 0, 0, 0.04) url("./img/login.jpg") top left repeat;
72+
background: rgba(0, 0, 0, 0.04) url("../img/login.jpg") top left repeat;
7173
background-size: cover;
7274
border-radius: 100% 0 0 100%;
7375
opacity: 1;
@@ -89,7 +91,7 @@ a {
8991

9092
.login .login-inner-form {
9193
width: 100%;
92-
max-width: 350px;
94+
max-width: 380px;
9395
color: #717171;
9496
text-align: center;
9597
}
@@ -121,6 +123,39 @@ a {
121123
text-align: left;
122124
}
123125

126+
.login .login-inner-form .form-group .input--suffix {
127+
position: relative;
128+
font-size: 14px;
129+
display: inline-block;
130+
width: 100%;
131+
}
132+
133+
.login .login-inner-form .form-group .input__suffix{
134+
position: absolute;
135+
top: 0;
136+
right: 5px;
137+
height: 100%;
138+
color: #c0c4cc;
139+
text-align: center;
140+
}
141+
142+
.login .login-inner-form .form-group .input__suffix .input__suffix-inner{
143+
pointer-events: all;
144+
padding-right: 10px;
145+
}
146+
147+
.login .login-inner-form .form-group .input__suffix .input__suffix-inner .iconfont{
148+
height: 100%;
149+
width: 25px;
150+
text-align: center;
151+
line-height: 38px;
152+
cursor: pointer;
153+
}
154+
155+
.login .login-inner-form .form-group .input__suffix .input__suffix-inner .iconfont:hover{
156+
color: #909399;
157+
}
158+
124159
.login .login-inner-form .error-text {
125160
margin-bottom: 5px;
126161
color: #f56c6c;
@@ -141,11 +176,10 @@ a {
141176
}
142177

143178
.login .login-inner-form .btn-md {
144-
padding: 10px 30px 10px 30px;
179+
padding: 8px 30px 8px 30px;
145180
font-weight: 600;
146181
font-size: 14px;
147182
letter-spacing: 1px;
148-
border-radius: 50px;
149183
cursor: pointer;
150184
}
151185

@@ -325,25 +359,63 @@ input[type="radio"] {
325359
margin-top: 15px;
326360
}
327361

328-
.details .auth-types {
329-
margin: 10px auto 0;
330-
padding: 20px;
362+
.details .divider{
363+
height: 1px;
364+
background: #ccc;
365+
width: 100%;
366+
margin: 12px 0;
367+
}
368+
369+
.details .desc{
370+
font-size: 14px;
371+
color: #464a4e;
372+
font-weight: 400;
373+
display: block;
374+
margin-top: 35px;
375+
}
376+
377+
.details .auth-types{
378+
text-align: right;
379+
margin-top: 15px;
380+
}
381+
382+
.details .auth-types .methods-desc{
383+
font-weight: 400;
384+
font-size: 14px;
331385
}
332386

333387
.details .auth-types a {
334388
display: inline-block;
335-
width: 100%;
336-
height: 45px;
337-
margin-bottom: 15px;
338-
color: white;
389+
margin: 0px 5px;
390+
color: #007bff;
339391
font-weight: 400;
340-
font-size: 18px;
392+
font-size: 14px;
341393
transition: all 0.3s;
342394
user-select: none;
343395
}
344396

345397
.details .auth-types a:hover {
346398
text-decoration: none;
399+
border-color: #007bff;
400+
color: #007bff;
401+
}
402+
403+
.details .auth-types a .iconfont {
404+
font-size: 25px;
405+
vertical-align: bottom;
406+
}
407+
408+
.details .auth-types .function-btn{
409+
color: #717171;
410+
}
411+
412+
.details .auth-types .function-btn:hover{
413+
color: #007bff;
414+
}
415+
416+
417+
.details .auth-types .divide {
418+
color: #ced4da;
347419
}
348420

349421
.details .auth-types p {
@@ -354,22 +426,13 @@ input[type="radio"] {
354426
}
355427

356428
.details .auth-types .login-button-show {
357-
display: block;
358-
line-height: 45px;
359-
letter-spacing: 1px;
360-
background: #376bff;
361-
border-radius: 5px;
429+
display: inline-block;
430+
line-height: 35px;
362431
}
363432

364-
.details .auth-types .login-button-show:hover {
365-
background: #2c5ce4;
366-
}
367433

368434
.details .auth-types .login-button-show .iconfont {
369435
position: relative;
370-
top: 2px;
371-
margin-right: 3px;
372-
font-size: 26px;
373436
}
374437

375438
.grant-access-container .heading {

custom-web/static/js/axios.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

custom-web/static/js/main.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const hostname = window.location.hostname;
2+
const protocol = window.location.protocol;
3+
4+
// login();
5+
var dex = new Vue({
6+
el: "#dex-login",
7+
delimiters: ["{{{", "}}}"],
8+
data: {
9+
loginForm: {
10+
account: "",
11+
password: "",
12+
},
13+
showRegistration:false,
14+
showLoginError:false,
15+
showPassword:false
16+
},
17+
methods: {
18+
async login() {
19+
const payload = this.loginForm;
20+
try {
21+
const userInfoRes = await axios.post("/api/v1/login", payload);
22+
const userInfo = userInfoRes.data;
23+
if (userInfo) {
24+
store.set("userInfo", userInfo);
25+
const roleBindingRes = await axios.get(
26+
`/api/v1/userbindings?uid=${userInfo.uid}`,
27+
{
28+
headers: {
29+
Authorization: `Bearer ${userInfo.token}`,
30+
},
31+
}
32+
);
33+
const roleBinding = roleBindingRes.data;
34+
if (roleBinding) {
35+
const role = roleBinding.map((item) => item.role);
36+
store.set("role", role);
37+
window.location.href = `${protocol}//${hostname}/v1/projects`;
38+
}
39+
}
40+
}
41+
catch (error) {
42+
this.showLoginError = true;
43+
}
44+
45+
},
46+
async registrationCheck(){
47+
const registrationRes = await axios.get(`/api/v1/features/RegisterTrigger`);
48+
if (registrationRes.data && registrationRes.data.enabled) {
49+
this.showRegistration = true
50+
} else {
51+
this.showRegistration = false
52+
}
53+
}
54+
},
55+
mounted() {
56+
this.registrationCheck();
57+
},
58+
});

custom-web/static/js/store.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

custom-web/static/js/vue.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

custom-web/templates/footer.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ <h3>高效研发从现在开始</h3>
2222
</div>
2323
</body>
2424

25-
</html>
25+
</html>
26+
<script src="{{ url .ReqPath "static/js/axios.min.js" }}"></script>
27+
<script src="{{ url .ReqPath "static/js/store.min.js" }}"></script>
28+
<script src="{{ url .ReqPath "static/js/vue.min.js" }}"></script>
29+
<script src="{{ url .ReqPath "static/js/main.js" }}"></script>
30+

custom-web/templates/header.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:200,300,400,500,600,700" />
2424
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:200,300,400,500,600,700"
2525
media="all" onload="this.media='all'" />
26-
<link href="{{ url .ReqPath "static/bootstrap.css" }}" rel="stylesheet">
27-
<link href="{{ url .ReqPath "static/main.css" }}" rel="stylesheet">
26+
<link href="{{ url .ReqPath "static/css/bootstrap.css" }}" rel="stylesheet">
27+
<link href="{{ url .ReqPath "static/css/main.css" }}" rel="stylesheet">
2828
<link href="{{ url .ReqPath "theme/styles.css" }}" rel="stylesheet">
29-
<link rel="stylesheet" href="//at.alicdn.com/t/font_1282370_mbsho89kty9.css"
29+
<link rel="stylesheet" href="//at.alicdn.com/t/font_1282370_f2amwt7wbik.css"
3030
media="all" onload="this.media='all'" />
31-
<title>第三方登录</title>
31+
<title>登录</title>
3232
</head>
3333

3434
<body>
35-
<div style="height: 100%; display: flex; flex-direction: column">
35+
<div id="dex-login" style="height: 100%; display: flex; flex-direction: column">
3636
<div class="login tab-box" style="height: 100%">
3737
<div class="container-fluid">
3838
<div class="row">

0 commit comments

Comments
 (0)