Skip to content

Commit bb9c15b

Browse files
committed
Change user login page into dex.
Signed-off-by: leozhang2018 <[email protected]>
1 parent 8996fa1 commit bb9c15b

File tree

10 files changed

+322
-111
lines changed

10 files changed

+322
-111
lines changed
File renamed without changes.

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

Lines changed: 30 additions & 24 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;
@@ -141,11 +143,10 @@ a {
141143
}
142144

143145
.login .login-inner-form .btn-md {
144-
padding: 10px 30px 10px 30px;
146+
padding: 8px 30px 8px 30px;
145147
font-weight: 600;
146148
font-size: 14px;
147149
letter-spacing: 1px;
148-
border-radius: 50px;
149150
cursor: pointer;
150151
}
151152

@@ -325,25 +326,39 @@ input[type="radio"] {
325326
margin-top: 15px;
326327
}
327328

328-
.details .auth-types {
329-
margin: 10px auto 0;
330-
padding: 20px;
329+
.details .divider{
330+
height: 1px;
331+
background: #ccc;
332+
width: 100%;
333+
margin: 12px 0;
334+
}
335+
336+
.details .desc{
337+
font-size: 14px;
338+
color: #464a4e;
339+
font-weight: 400;
340+
display: block;
341+
margin-top: 35px;
331342
}
332343

333344
.details .auth-types a {
334345
display: inline-block;
335-
width: 100%;
336-
height: 45px;
337-
margin-bottom: 15px;
338-
color: white;
346+
margin: 0px 5px;
347+
height: 35px;
348+
color: #007bff;
349+
border: 1px solid #007bff;
350+
padding: 0 10px;
351+
border-radius: 4px;
339352
font-weight: 400;
340-
font-size: 18px;
353+
font-size: 13px;
341354
transition: all 0.3s;
342355
user-select: none;
343356
}
344357

345358
.details .auth-types a:hover {
346359
text-decoration: none;
360+
border-color: #007bff;
361+
color: #007bff;
347362
}
348363

349364
.details .auth-types p {
@@ -355,21 +370,12 @@ input[type="radio"] {
355370

356371
.details .auth-types .login-button-show {
357372
display: block;
358-
line-height: 45px;
359-
letter-spacing: 1px;
360-
background: #376bff;
361-
border-radius: 5px;
373+
line-height: 35px;
362374
}
363375

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

368377
.details .auth-types .login-button-show .iconfont {
369378
position: relative;
370-
top: 2px;
371-
margin-right: 3px;
372-
font-size: 26px;
373379
}
374380

375381
.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: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
},
16+
methods: {
17+
async login() {
18+
const payload = this.loginForm;
19+
try {
20+
const userInfoRes = await axios.post("/api/v1/login", payload);
21+
const userInfo = userInfoRes.data;
22+
if (userInfo) {
23+
store.set("userInfo", userInfo);
24+
const roleBindingRes = await axios.get(
25+
`/api/v1/userbindings?uid=${userInfo.uid}`,
26+
{
27+
headers: {
28+
Authorization: `Bearer ${userInfo.token}`,
29+
},
30+
}
31+
);
32+
const roleBinding = roleBindingRes.data;
33+
if (roleBinding) {
34+
const role = roleBinding.map((item) => item.role);
35+
store.set("role", role);
36+
window.location.href = `${protocol}//${hostname}/v1/projects`;
37+
}
38+
}
39+
}
40+
catch (error) {
41+
this.showLoginError = true;
42+
}
43+
44+
},
45+
findPassword() {
46+
window.location.href = `${protocol}//${hostname}/signin?findPassword=true`;
47+
},
48+
signUp() {
49+
window.location.href = `${protocol}//${hostname}/signin?signUp=true`;
50+
},
51+
async registrationCheck(){
52+
const registrationRes = await axios.get(`/api/v1/features/RegisterTrigger`);
53+
if (registrationRes.data && registrationRes.data.enabled) {
54+
this.showRegistration = true
55+
} else {
56+
this.showRegistration = false
57+
}
58+
}
59+
},
60+
mounted() {
61+
this.registrationCheck();
62+
},
63+
});

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: 4 additions & 4 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">
2929
<link rel="stylesheet" href="//at.alicdn.com/t/font_1282370_mbsho89kty9.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)