Skip to content

Commit eb07802

Browse files
committed
修复了登录系统的Bug,并提升了使用体验;更新标签页title
1 parent c2d158f commit eb07802

File tree

19 files changed

+530
-2261
lines changed

19 files changed

+530
-2261
lines changed

forward-server/Controllers/LoginCtrl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (c *LoginCtrl) DoLogin() {
3737
logs.Debug("用户不存在")
3838
c.Data["json"] = Models.FuncResult{Code: 1, Msg: "用户名或密码错误"}
3939
c.ServeJSON()
40-
//return
40+
return
4141
}
4242

4343
descryptPwd := Utils.GetMd5(passWord)

forward-server/conf/app.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
app.name = "PortForward"
3-
app.cname = "端口转发系统"
4-
servername = "PortForward-Server"
2+
app.name = "ProForward"
3+
app.cname = "ProForward"
4+
servername = "ProForward-WebServer"
55
runmode ="dev"
66
#runmode ="prod"
77
viewspath = "views"

forward-server/lastupdate.tmp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"D:\\压缩包文件\\12-大创\\省创\\ProForward\\forward-server\\Controllers":1669726415157889800,"E:\\大创GO\\ProForward\\forward-server\\Controllers":1668001936081998800,"E:\\大创GO\\port-forward\\forward-server\\Controllers":1667268803267866600}
1+
{"D:\\压缩包文件\\12-大创\\省创\\ProForward\\forward-server\\Controllers":1668524017595681300,"E:\\大创GO\\ProForward\\forward-server\\Controllers":1669809050798012900,"E:\\大创GO\\port-forward\\forward-server\\Controllers":1667268803267866600}

forward-server/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ func main() {
4848
logs.Async()
4949

5050
logs.Debug("★★★★★★★★★★★★★★★★★★★★")
51-
logs.Debug(" port-forward 启动")
5251
logs.Debug("")
53-
logs.Debug("项目地址:https://github.com/tavenli/port-forward")
52+
logs.Debug("ProForward Web Server 启动")
5453
logs.Debug("")
5554
logs.Debug("★★★★★★★★★★★★★★★★★★★★")
5655

forward-server/routers/commentsRouter_.go

Lines changed: 341 additions & 341 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Loading

forward-server/views/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<meta http-equiv="X-UA-Compatible" content="IE=edge">
99

10-
<title>{{config "String" "app.cname" "端口转发系统"}} - V1.3</title>
10+
<title>{{config "String" "app.cname" "端口转发系统"}} Web Server</title>
11+
<link rel="icon" href="../static/img/server-solid.svg" type="image/x-icon">
1112
<meta name="keywords" content="端口转发">
1213

1314
<link href="/static/layui/css/layui.css" rel="stylesheet" media="all"/>

forward-server/views/login.html

Lines changed: 171 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,189 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<title>{{config "String" "app.cname" "端口转发系统"}} - V1.3</title>
7-
8-
<!-- Google Font: Source Sans Pro -->
9-
<link rel="stylesheet"
10-
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
11-
<!-- Font Awesome -->
12-
<link rel="stylesheet" href="../static/plugins/fontawesome-free/css/all.min.css">
13-
<!-- overlayScrollbars -->
14-
<link rel="stylesheet" href="../static/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
15-
<!-- Theme style -->
16-
<link rel="stylesheet" href="../static/dist/css/adminlte.min.css">
17-
18-
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" /> -->
19-
<!-- <link href="https://getbootstrap.com/docs/5.2/assets/css/docs.css" rel="stylesheet" /> -->
20-
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script> -->
21-
<!-- SweetAlert2 -->
22-
<link rel="stylesheet" href="../static/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
23-
<!-- Toastr -->
24-
<link rel="stylesheet" href="../static/plugins/toastr/toastr.min.css">
25-
</head>
26-
<body class="hold-transition login-page">
27-
<div class="login-box">
28-
<!-- /.login-logo -->
29-
<div class="card card-outline card-primary">
30-
<div class="card-header text-center">
31-
<a href="" class="h1">Pro<b>Forward</b></a>
32-
</div>
33-
<div class="card-body">
34-
<p class="login-box-msg">Enter your username and password</p>
35-
36-
<form id="forms" action="/u/Dologins" method="post">
37-
<div class="input-group mb-3">
38-
<input type="text" name="userName" class="form-control" placeholder="请输入用户名">
39-
<div class="input-group-append">
40-
<div class="input-group-text">
41-
<span class="fas fa-envelope"></span>
42-
</div>
43-
</div>
44-
</div>
45-
<div class="input-group mb-3">
46-
<input type="password" name="passWord" class="form-control" placeholder="请输入密码">
47-
<div class="input-group-append">
48-
<div class="input-group-text">
49-
<span class="fas fa-lock"></span>
50-
</div>
51-
</div>
52-
</div>
53-
<div class="row">
54-
<div class="col-8">
55-
<div class="icheck-primary">
56-
<input type="checkbox" id="remember">
57-
<label for="remember">
58-
Remember Me
59-
</label>
60-
</div>
61-
</div>
62-
<!-- /.col -->
63-
</div>
64-
<!-- /.social-auth-links -->
65-
</form>
66-
67-
<div class="">
68-
<button type="button" class="btn btn-block btn-primary"
69-
onclick="loginfunceshi();">登录</button>
70-
</div>
71-
<p></p>
72-
<p class="mb-1">
73-
<a href="forgot-password.html">I forgot my password</a>
74-
</p>
75-
<p class="mb-0">
76-
<a href="register.html" class="text-center">Register a new membership</a>
77-
</p>
78-
</div>
79-
<!-- /.card-body -->
80-
</div>
81-
<!-- /.card -->
82-
</div>
83-
<!-- /.login-box -->
84-
85-
<!-- jQuery -->
86-
<script src="../static/plugins/jquery/jquery.min.js"></script>
87-
<!-- Bootstrap 4 -->
88-
<script src="../static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
89-
<!-- overlayScrollbars -->
90-
<script src="../static/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
91-
<!-- AdminLTE App -->
92-
<script src="../static/dist/js/adminlte.min.js"></script>
93-
94-
<!-- SweetAlert2 -->
95-
<script src="../static/plugins/sweetalert2/sweetalert2.min.js"></script>
96-
<!-- Toastr -->
97-
<script src="../static/plugins/toastr/toastr.min.js"></script>
98-
<!-- Page specific script -->
99-
100-
<script type="text/javascript">
101-
102-
103-
function loginfunceshi() {
104-
105-
106-
var Toast = Swal.mixin({
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>{{config "String" "app.cname" "端口转发系统"}} Web Server</title>
7+
<link rel="icon" href="../static/img/server.svg" type="image/x-icon">
8+
<!-- Google Font: Source Sans Pro -->
9+
<link rel="stylesheet"
10+
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
11+
<!-- Font Awesome -->
12+
<link rel="stylesheet" href="../static/plugins/fontawesome-free/css/all.min.css">
13+
<!-- overlayScrollbars -->
14+
<link rel="stylesheet" href="../static/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
15+
<!-- Theme style -->
16+
<link rel="stylesheet" href="../static/dist/css/adminlte.min.css">
17+
18+
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" /> -->
19+
<!-- <link href="https://getbootstrap.com/docs/5.2/assets/css/docs.css" rel="stylesheet" /> -->
20+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script> -->
21+
<!-- SweetAlert2 -->
22+
<link rel="stylesheet" href="../static/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
23+
<!-- Toastr -->
24+
<link rel="stylesheet" href="../static/plugins/toastr/toastr.min.css">
25+
</head>
26+
<body class="hold-transition login-page">
27+
<div class="login-box">
28+
<!-- /.login-logo -->
29+
<div class="card card-outline card-primary">
30+
<div class="card-header text-center">
31+
<a href="" class="h1">Pro<b>Forward</b></a>
32+
</div>
33+
<div class="card-body">
34+
<p class="login-box-msg">Enter your username and password</p>
35+
36+
<form id="forms" action="/u/Dologins" method="post">
37+
<div class="input-group mb-3">
38+
<input type="text" name="userName" class="form-control" placeholder="请输入用户名">
39+
<div class="input-group-append">
40+
<div class="input-group-text">
41+
<span class="fas fa-envelope"></span>
42+
</div>
43+
</div>
44+
</div>
45+
<div class="input-group mb-3">
46+
<input type="password" name="passWord" class="form-control" placeholder="请输入密码">
47+
<div class="input-group-append">
48+
<div class="input-group-text">
49+
<span class="fas fa-lock"></span>
50+
</div>
51+
</div>
52+
</div>
53+
<div class="row">
54+
<div class="col-8">
55+
<div class="icheck-primary">
56+
<input type="checkbox" id="remember">
57+
<label for="remember">
58+
Remember Me
59+
</label>
60+
</div>
61+
</div>
62+
<!-- /.col -->
63+
</div>
64+
<!-- /.social-auth-links -->
65+
</form>
66+
67+
<div class="">
68+
<button id="loginbtn" type="submit" class="btn btn-block btn-primary"
69+
onclick="loginfunceshi();">登录
70+
</button>
71+
</div>
72+
<p></p>
73+
<p class="mb-1">
74+
<a onclick="function forgetPass() {
75+
var Toast = Swal.mixin({
10776
toast: true,
10877
position: 'top-end',
10978
showConfirmButton: false,
11079
timer: 3000,
11180
});
112-
113-
114-
var postData = $("#forms").serializeArray();
115-
$.post($("#forms").attr("action"), postData, function(json) {
116-
//var data = $.parseJSON(json);
117-
if (json.Code == 0) {
118-
window.location.href="/u/main";
119-
document.cookie="countSize=1;";
120-
document.cookie="userInfo="+json.Msg;
121-
} else {
12281
Toast.fire({
123-
icon: 'error',
124-
title: '登录失败',
125-
text: json.Msg
82+
icon: 'warning',
83+
title: '管理员已禁用该功能',
84+
text: 'Contact administrator'
12685
})
127-
}
128-
}, "json");
129-
130-
// 解决灰屏且无法操作问题
131-
$(".modal-backdrop").remove();
132-
$('body').removeClass('modal-open');
133-
// loadFrameContent('/u/forwardList');
134-
}
135-
136-
137-
$(function() {
138-
var Toast = Swal.mixin({
86+
}
87+
forgetPass();" href="javascript:void(0);">I forgot my password</a>
88+
</p>
89+
<p class="mb-0">
90+
<a onclick="function signup() {
91+
var Toast = Swal.mixin({
13992
toast: true,
14093
position: 'top-end',
14194
showConfirmButton: false,
14295
timer: 3000,
143-
14496
});
97+
Toast.fire({
98+
icon: 'warning',
99+
title: '管理员已禁止注册',
100+
text: 'Contact administrator'
101+
})
102+
}
103+
signup();" href="javascript:void(0);" class="text-center">Register a new membership</a>
104+
</p>
105+
</div>
106+
<!-- /.card-body -->
107+
</div>
108+
<!-- /.card -->
109+
</div>
110+
<!-- /.login-box -->
145111

146-
$('.loginbtn').click(function() {
112+
<!-- jQuery -->
113+
<script src="../static/plugins/jquery/jquery.min.js"></script>
114+
<!-- Bootstrap 4 -->
115+
<script src="../static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
116+
<!-- overlayScrollbars -->
117+
<script src="../static/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
118+
<!-- AdminLTE App -->
119+
<script src="../static/dist/js/adminlte.min.js"></script>
147120

148-
149-
150-
});
121+
<!-- SweetAlert2 -->
122+
<script src="../static/plugins/sweetalert2/sweetalert2.min.js"></script>
123+
<!-- Toastr -->
124+
<script src="../static/plugins/toastr/toastr.min.js"></script>
125+
<!-- Page specific script -->
126+
127+
<script type="text/javascript">
128+
129+
//键盘回车操作监控
130+
document.onkeydown = function(e) {
131+
// e = e || window.event;
132+
if(e.key === "Enter") {
133+
$("#loginbtn").click();//提交按钮的id.click();
134+
return false;//防止页面跳转刷新掉
135+
}
136+
}
137+
138+
function loginfunceshi() {
139+
140+
141+
var Toast = Swal.mixin({
142+
toast: true,
143+
position: 'top-end',
144+
showConfirmButton: false,
145+
timer: 3000,
146+
});
147+
148+
149+
var postData = $("#forms").serializeArray();
150+
$.post($("#forms").attr("action"), postData, function (json) {
151+
//var data = $.parseJSON(json);
152+
if (json.Code == 0) {
153+
window.location.href = "/u/main";
154+
document.cookie = "countSize=1;";
155+
document.cookie = "userInfo=" + json.Msg;
156+
} else {
157+
Toast.fire({
158+
icon: 'error',
159+
title: '登录失败',
160+
text: json.Msg
161+
})
162+
}
163+
}, "json");
164+
165+
// 解决灰屏且无法操作问题
166+
$(".modal-backdrop").remove();
167+
$('body').removeClass('modal-open');
168+
// loadFrameContent('/u/forwardList');
169+
}
170+
171+
172+
$(function () {
173+
var Toast = Swal.mixin({
174+
toast: true,
175+
position: 'top-end',
176+
showConfirmButton: false,
177+
timer: 3000,
178+
179+
});
180+
181+
$('.loginbtn').click(function () {
182+
183+
184+
});
151185

152-
});
153-
</script>
154-
</body>
186+
});
187+
</script>
188+
</body>
155189
</html>

0 commit comments

Comments
 (0)