正在显示
10 个修改的文件
包含
548 行增加
和
302 行删除
... | ... | @@ -9,7 +9,7 @@ from .models import * |
9 | 9 | from .oauth2 import authorization, require_oauth, generate_user_info |
10 | 10 | from authlib.oauth2 import OAuth2Error |
11 | 11 | from authlib.integrations.flask_oauth2 import current_token |
12 | -from . import user_create, client_create, client_query,user_query | |
12 | +from . import user_create, client_create, client_query, user_query, user_update, user_delete | |
13 | 13 | |
14 | 14 | |
15 | 15 | def current_user(): |
... | ... | @@ -107,19 +107,35 @@ class DataManager(BlueprintApi): |
107 | 107 | if not user: |
108 | 108 | return render_template("auth/authorize.html", user=user, grant=grant) |
109 | 109 | # return render_template("auth/login1.html", user=user, grant=grant) |
110 | - if not user and "username" in request.form: | |
111 | - username = request.form.get("username") | |
112 | - password = request.form.get("password") | |
113 | - user = User.query.filter_by( | |
114 | - username=username, password=password).first() | |
115 | - if User: | |
110 | + error = "" | |
111 | + if not user: | |
112 | + if not "username" in request.form or not request.form.get("username"): | |
113 | + error = "用户名不可为空" | |
114 | + elif not "password" in request.form or not request.form.get("password"): | |
115 | + error = "密码不可为空" | |
116 | + else: | |
117 | + username = request.form.get("username") | |
118 | + password = request.form.get("password") | |
119 | + user = User.query.filter_by( | |
120 | + username=username, password=password).first() | |
121 | + if not user: | |
122 | + error = "账号或密码不正确" | |
123 | + | |
124 | + if user: | |
116 | 125 | session["id"] = user.id |
117 | - grant_user = user | |
126 | + grant_user = user | |
127 | + return authorization.create_authorization_response(grant_user=grant_user) | |
128 | + | |
129 | + try: | |
130 | + grant = authorization.validate_consent_request(end_user=user) | |
131 | + except OAuth2Error as error: | |
132 | + return jsonify(dict(error.get_body())) | |
133 | + return render_template("auth/authorize.html", user=user, grant=grant, error=error) | |
134 | + | |
118 | 135 | # if request.form["confirm"]: |
119 | 136 | # grant_user = user |
120 | 137 | # else: |
121 | 138 | # grant_user = None |
122 | - return authorization.create_authorization_response(grant_user=grant_user) | |
123 | 139 | |
124 | 140 | @staticmethod |
125 | 141 | @bp.route("/token", methods=["POST"]) |
... | ... | @@ -177,8 +193,7 @@ class DataManager(BlueprintApi): |
177 | 193 | 获取用户列表 |
178 | 194 | """ |
179 | 195 | return user_query.Api().result |
180 | - | |
181 | - | |
196 | + | |
182 | 197 | @staticmethod |
183 | 198 | @bp.route("/users", methods=["POST"]) |
184 | 199 | @swag_from(user_create.Api.api_doc) |
... | ... | @@ -189,6 +204,24 @@ class DataManager(BlueprintApi): |
189 | 204 | return user_create.Api().result |
190 | 205 | |
191 | 206 | @staticmethod |
207 | + @bp.route("/userEdit", methods=["POST"]) | |
208 | + @swag_from(user_update.Api.api_doc) | |
209 | + def user_update(): | |
210 | + """ | |
211 | + 更新用户信息 | |
212 | + """ | |
213 | + return user_update.Api().result | |
214 | + | |
215 | + @staticmethod | |
216 | + @bp.route("/userDelete", methods=["POST"]) | |
217 | + @swag_from(user_delete.Api.api_doc) | |
218 | + def user_delete(): | |
219 | + """ | |
220 | + 删除用户 | |
221 | + """ | |
222 | + return user_delete.Api().result | |
223 | + | |
224 | + @staticmethod | |
192 | 225 | @bp.route("/client", methods=["POST"]) |
193 | 226 | @swag_from(client_create.Api.api_doc) |
194 | 227 | def client_create(): | ... | ... |
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | |
6 | 6 | from .models import * |
7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
8 | +import time | |
8 | 9 | |
9 | 10 | |
10 | 11 | class Api(ApiTemplate): |
... | ... | @@ -13,8 +14,8 @@ class Api(ApiTemplate): |
13 | 14 | def para_check(self): |
14 | 15 | if not self.para.get("username"): |
15 | 16 | raise Exception("username is null") |
16 | - if not self.para.get("password"): | |
17 | - raise Exception("password is null") | |
17 | + if not self.para.get("pwd"): | |
18 | + raise Exception("pwd is null") | |
18 | 19 | if not self.para.get("role"): |
19 | 20 | raise Exception("role is null") |
20 | 21 | |
... | ... | @@ -26,17 +27,26 @@ class Api(ApiTemplate): |
26 | 27 | try: |
27 | 28 | # 业务逻辑 |
28 | 29 | username = self.para.get("username") |
29 | - password = self.para.get("password") | |
30 | + password = self.para.get("pwd") | |
30 | 31 | role = self.para.get("role") |
32 | + company = self.para.get("company", None) | |
33 | + position = self.para.get("position", None) | |
34 | + email = self.para.get("email", None) | |
35 | + phone = self.para.get("phone", None) | |
31 | 36 | # 是否重名 |
32 | - if(len(User.query.filter_by(username=username).all()) > 0): | |
37 | + if(User.query.filter_by(username=username).one_or_none()): | |
33 | 38 | res["msg"] = "username 已存在" |
34 | 39 | else: |
35 | - user = User(username=username, password=password, role=role) | |
40 | + user = User(username=username, password=password, role=role, | |
41 | + phone=phone, company=company, position=position, email=email, | |
42 | + create_time=time.strftime( | |
43 | + "%Y-%m-%d %H:%M:%S", time.localtime()), | |
44 | + update_time=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) | |
36 | 45 | db.session.add(user) |
37 | 46 | db.session.commit() |
38 | 47 | res["msg"] = "用户创建成功" |
39 | - res["data"] = {user.id, user.username, user.role} | |
48 | + res["data"] = {"id": user.id, | |
49 | + "username": user.username, "role": user.role} | |
40 | 50 | res["result"] = True |
41 | 51 | except Exception as e: |
42 | 52 | db.session.rollback() |
... | ... | @@ -52,7 +62,7 @@ class Api(ApiTemplate): |
52 | 62 | "type": "string", |
53 | 63 | "description": "用户名", |
54 | 64 | "required": "true"}, |
55 | - {"name": "password", | |
65 | + {"name": "pwd", | |
56 | 66 | "in": "formData", |
57 | 67 | "type": "string", |
58 | 68 | "description": "密码", |
... | ... | @@ -61,7 +71,27 @@ class Api(ApiTemplate): |
61 | 71 | "in": "formData", |
62 | 72 | "type": "string", |
63 | 73 | "description": "角色", |
64 | - "required": "true"} | |
74 | + "required": "true"}, | |
75 | + {"name": "company", | |
76 | + "in": "formData", | |
77 | + "type": "string", | |
78 | + "description": "单位", | |
79 | + "required": ""}, | |
80 | + {"name": "email", | |
81 | + "in": "formData", | |
82 | + "type": "string", | |
83 | + "description": "邮件", | |
84 | + "required": ""}, | |
85 | + {"name": "phone", | |
86 | + "in": "formData", | |
87 | + "type": "string", | |
88 | + "description": "电话", | |
89 | + "required": ""}, | |
90 | + {"name": "position", | |
91 | + "in": "formData", | |
92 | + "type": "string", | |
93 | + "description": "职位", | |
94 | + "required": ""}, | |
65 | 95 | ], |
66 | 96 | "responses": { |
67 | 97 | 200: { | ... | ... |
app/modules/auth/user_delete.py
0 → 100644
1 | +from app.util.component.ApiTemplate import ApiTemplate | |
2 | +import time | |
3 | +from .models import * | |
4 | + | |
5 | + | |
6 | +class Api(ApiTemplate): | |
7 | + api_name = "更新用户信息" | |
8 | + | |
9 | + def para_check(self): | |
10 | + if not self.para.get("guid"): | |
11 | + raise Exception("guid is null") | |
12 | + return super().para_check() | |
13 | + | |
14 | + def process(self): | |
15 | + res = {} | |
16 | + res["result"] = False | |
17 | + try: | |
18 | + user_guid = int(self.para.get("guid")) | |
19 | + userinfo = User.query.filter_by(id=user_guid).one_or_none() | |
20 | + if not userinfo: | |
21 | + res["msg"] = "用户不存在" | |
22 | + else: | |
23 | + db.session.delete(userinfo) | |
24 | + db.session.commit() | |
25 | + res["result"] = True | |
26 | + res["msg"] = "删除用户成功" | |
27 | + except Exception as e: | |
28 | + db.session.rollback() | |
29 | + raise e | |
30 | + return res | |
31 | + | |
32 | + api_doc = { | |
33 | + "tags": ["认证接口"], | |
34 | + "parameters": [ | |
35 | + {"name": "guid", | |
36 | + "in": "formData", | |
37 | + "type": "string", | |
38 | + "description": "用户id", | |
39 | + "required": "true"} | |
40 | + ], | |
41 | + "responses": { | |
42 | + 200: { | |
43 | + "schema": { | |
44 | + "properties": { | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + } | |
49 | + } | ... | ... |
... | ... | @@ -21,15 +21,17 @@ class Api(ApiTemplate): |
21 | 21 | try: |
22 | 22 | # 业务逻辑 |
23 | 23 | pass |
24 | - page_index = int(self.para.get("pageIndex", "0")) | |
25 | - page_size = int(self.para.get("pageSize", "1000")) | |
24 | + page_index = int(self.para.get("page_index", "0")) | |
25 | + page_size = int(self.para.get("page_size", "1000")) | |
26 | 26 | name = self.para.get("name") |
27 | 27 | id = self.para.get('guid') |
28 | 28 | |
29 | 29 | if id: |
30 | 30 | tmp_user = User.query.filter_by(id=id).first() |
31 | - res["data"] = {"id": tmp_user.id, "username": tmp_user.username, | |
32 | - "role": tmp_user.role} | |
31 | + res["data"] = {"guid": tmp_user.id, "username": tmp_user.username, | |
32 | + "role": tmp_user.role, "company": tmp_user.company, | |
33 | + "position": tmp_user.position, "email": tmp_user.email, | |
34 | + "phone": tmp_user.phone} | |
33 | 35 | else: |
34 | 36 | # 获取集合 |
35 | 37 | userLinq = User.query.order_by(User.id.desc()) |
... | ... | @@ -42,7 +44,7 @@ class Api(ApiTemplate): |
42 | 44 | res["data"] = { |
43 | 45 | "count": tmp_count, |
44 | 46 | "list": list(map(lambda t: |
45 | - {"id": t.id, "username": t.username, | |
47 | + {"guid": t.id, "username": t.username, | |
46 | 48 | "role": t.role}, |
47 | 49 | tmp_list))} |
48 | 50 | res["result"] = True | ... | ... |
app/modules/auth/user_update.py
0 → 100644
1 | +from app.util.component.ApiTemplate import ApiTemplate | |
2 | +import time | |
3 | +from .models import * | |
4 | + | |
5 | + | |
6 | +class Api(ApiTemplate): | |
7 | + api_name = "更新用户信息" | |
8 | + | |
9 | + def para_check(self): | |
10 | + if not self.para.get("guid"): | |
11 | + raise Exception("guid is null") | |
12 | + return super().para_check() | |
13 | + | |
14 | + def process(self): | |
15 | + res = {} | |
16 | + res["result"] = False | |
17 | + try: | |
18 | + user_guid = int(self.para.get("guid")) | |
19 | + obj_value = {"company": "company", "email": "email", | |
20 | + "position": "position", "phone": "phone", "password": "pwd"} | |
21 | + | |
22 | + userinfo = User.query.filter_by(id=user_guid) | |
23 | + if not userinfo.one_or_none(): | |
24 | + res["msg"] = "数据不存在" | |
25 | + else: | |
26 | + for key in obj_value: | |
27 | + if self.para.__contains__(obj_value[key]): | |
28 | + value = self.para.get(obj_value[key]) | |
29 | + value = value if value is "None" or value is "none" else None | |
30 | + userinfo.update({key: value}) | |
31 | + db.session.commit() | |
32 | + res["result"] = True | |
33 | + res["msg"] = "更新用户信息成功" | |
34 | + except Exception as e: | |
35 | + db.session.rollback() | |
36 | + raise e | |
37 | + return res | |
38 | + | |
39 | + api_doc = { | |
40 | + "tags": ["认证接口"], | |
41 | + "parameters": [ | |
42 | + {"name": "guid", | |
43 | + "in": "formData", | |
44 | + "type": "string", | |
45 | + "description": "用户id", | |
46 | + "required": "true"}, | |
47 | + {"name": "pwd", | |
48 | + "in": "formData", | |
49 | + "type": "string", | |
50 | + "description": "密码", | |
51 | + "required": ""}, | |
52 | + {"name": "company", | |
53 | + "in": "formData", | |
54 | + "type": "string", | |
55 | + "description": "单位", | |
56 | + "required": ""}, | |
57 | + {"name": "email", | |
58 | + "in": "formData", | |
59 | + "type": "string", | |
60 | + "description": "邮件", | |
61 | + "required": ""}, | |
62 | + {"name": "phone", | |
63 | + "in": "formData", | |
64 | + "type": "string", | |
65 | + "description": "电话", | |
66 | + "required": ""}, | |
67 | + {"name": "position", | |
68 | + "in": "formData", | |
69 | + "type": "string", | |
70 | + "description": "职位", | |
71 | + "required": ""}, | |
72 | + ], | |
73 | + "responses": { | |
74 | + 200: { | |
75 | + "schema": { | |
76 | + "properties": { | |
77 | + } | |
78 | + } | |
79 | + } | |
80 | + } | |
81 | + } | ... | ... |
1 | -html, | |
2 | -body { | |
3 | - font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular; | |
4 | -} | |
5 | - | |
6 | -html, | |
7 | -body, | |
8 | -p, | |
9 | -input { | |
10 | - margin: 0; | |
11 | - padding: 0; | |
12 | -} | |
13 | - | |
14 | -.login { | |
15 | - background: url(../images/login_background.png) no-repeat; | |
16 | - background-size: 100% 100%; | |
17 | - width: 100%; | |
18 | - height: 100%; | |
19 | - position: relative; | |
20 | -} | |
21 | - | |
22 | -.login-container { | |
23 | - position: absolute; | |
24 | - top: -50px; | |
25 | - bottom: 0; | |
26 | - left: 0; | |
27 | - right: 0; | |
28 | - margin: auto; | |
29 | - width: 900px; | |
30 | - height: 454px; | |
31 | - background: #ffffff; | |
32 | - border-radius: 4px; | |
33 | - box-shadow: 2px 0 21px 0 rgba(38, 106, 184, 0.53); | |
34 | -} | |
35 | - | |
36 | -.login-container-logo { | |
37 | - margin: 0; | |
38 | - background: url(../images/login_logo.png) no-repeat; | |
39 | - width: 401px; | |
40 | - height: 455px; | |
41 | - overflow: hidden; | |
42 | - float: left; | |
43 | -} | |
44 | - | |
45 | -.login-container-header { | |
46 | - font-size: 22px; | |
47 | - font-weight: 700; | |
48 | - text-align: left; | |
49 | - color: #545454; | |
50 | - letter-spacing: 1px; | |
51 | - text-align: center; | |
52 | - margin-bottom: 54px; | |
53 | -} | |
54 | - | |
55 | -.login-container-form { | |
56 | - margin-left: 401px; | |
57 | - height: 100%; | |
58 | - padding: 80px; | |
59 | -} | |
60 | - | |
61 | -.login-container-form .form-group { | |
62 | - width: 296px; | |
63 | - margin: 0 auto; | |
64 | - margin-top: 22px; | |
65 | -} | |
66 | - | |
67 | -.login-container-form .has-feedback.feedback-left .form-control-feedback { | |
68 | - left: 0; | |
69 | - right: auto; | |
70 | - width: 38px; | |
71 | - height: 45px; | |
72 | - line-height: 45px; | |
73 | - z-index: 4; | |
74 | - color: #dcdcdc; | |
75 | - font-size: 16px; | |
76 | -} | |
77 | - | |
78 | -.login-container-form .has-feedback.feedback-left .micons-pwd { | |
79 | - font-size: 18px; | |
80 | - line-height: 48px; | |
81 | -} | |
82 | - | |
83 | -.login-container-form .has-feedback.feedback-left .form-control { | |
84 | - padding-left: 38px; | |
85 | - padding-right: 12px; | |
86 | - border: 1px solid #ebebeb; | |
87 | - border-radius: 4px; | |
88 | - height: 45px; | |
89 | - color: #999; | |
90 | - font-size: 16px; | |
91 | - letter-spacing: 1px; | |
92 | -} | |
93 | - | |
94 | -.login-container-form .has-feedback.feedback-left .form-control:hover, | |
95 | -.login-container-form .has-feedback.feedback-left .form-control:hover, | |
96 | -.login-container-form .has-feedback.feedback-left .form-control:focus { | |
97 | - border: 1px solid #3081c3; | |
98 | - outline: unset; | |
99 | - box-shadow: unset; | |
100 | -} | |
101 | - | |
102 | -.login-container-form .overhidden { | |
103 | - padding-left: 24px; | |
104 | - font-size: 14px; | |
105 | - color: #999999; | |
106 | - vertical-align: bottom; | |
107 | - line-height: 18px; | |
108 | -} | |
109 | - | |
110 | -.login-container-form .overhidden:hover { | |
111 | - color: #3081c3; | |
112 | -} | |
113 | - | |
114 | -.login-container-form .ftdms-checkbox span::before { | |
115 | - height: 15px; | |
116 | - width: 15px; | |
117 | - border-width: 1px; | |
118 | - top: 2px; | |
119 | -} | |
120 | - | |
121 | -#btn-login { | |
122 | - background: #3081c3; | |
123 | - height: 45px; | |
124 | - font-size: 16px; | |
125 | - font-weight: 400; | |
126 | - color: #ffffff; | |
127 | - letter-spacing: 1px; | |
128 | -} | |
129 | - | |
130 | -#btn-login:hover { | |
131 | - background: #2ba3f6; | |
132 | -} | |
133 | - | |
134 | -.form-control:focus, | |
135 | -.form-control:hover { | |
136 | - box-shadow: unset; | |
137 | - border: 1px solid #3081c3 !important; | |
138 | -} | |
139 | - | |
140 | -.form-control { | |
141 | - width: 100%; | |
142 | -} | |
143 | - | |
144 | -.btn-info,.btn-info:active { | |
145 | - border: 1px solid; | |
146 | -} | |
147 | - | |
148 | -.btn { | |
149 | - padding: 8px 12px; | |
150 | - border-radius: 2px; | |
151 | - outline: none !important; | |
152 | - -webkit-transition: 0.15s linear; | |
153 | - transition: 0.15s linear; | |
154 | -} | |
155 | - | |
156 | -button { | |
157 | - display: block; | |
158 | - width: 100%; | |
159 | - margin-bottom: 0; | |
160 | - line-height: 1.42857143; | |
161 | - text-align: center; | |
162 | - white-space: nowrap; | |
163 | - touch-action: manipulation; | |
164 | - cursor: pointer; | |
165 | - user-select: none; | |
166 | - font-family: inherit; | |
167 | - overflow: visible; | |
168 | - margin: 0; | |
169 | - font: inherit; | |
170 | - outline: none !important; | |
171 | -} | |
172 | - | |
173 | -.ftdms-checkbox span::before, | |
174 | -.ftdms-radio span::before { | |
175 | - content: ''; | |
176 | - position: absolute; | |
177 | - display: inline-block; | |
178 | - height: 18px; | |
179 | - width: 18px; | |
180 | - left: 0.5px; | |
181 | - top: 0px; | |
182 | - border: 2px solid #ebebeb; | |
183 | - -webkit-transition: all 0.1s; | |
184 | - -o-transition: all 0.1s; | |
185 | - transition: all 0.1s; | |
186 | -} | |
187 | - | |
188 | -:after, | |
189 | -:before { | |
190 | - -webkit-box-sizing: border-box; | |
191 | - -moz-box-sizing: border-box; | |
192 | - box-sizing: border-box; | |
1 | +html, | |
2 | +body { | |
3 | + font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular; | |
4 | +} | |
5 | + | |
6 | +html, | |
7 | +body, | |
8 | +p, | |
9 | +input { | |
10 | + margin: 0; | |
11 | + padding: 0; | |
12 | +} | |
13 | + | |
14 | +.login { | |
15 | + background: url(../images/login_background.png) no-repeat; | |
16 | + background-size: 100% 100%; | |
17 | + width: 100%; | |
18 | + height: 100%; | |
19 | + position: relative; | |
20 | +} | |
21 | + | |
22 | +.login-container { | |
23 | + position: absolute; | |
24 | + top: -50px; | |
25 | + bottom: 0; | |
26 | + left: 0; | |
27 | + right: 0; | |
28 | + margin: auto; | |
29 | + width: 900px; | |
30 | + height: 454px; | |
31 | + background: #ffffff; | |
32 | + border-radius: 4px; | |
33 | + box-shadow: 2px 0 21px 0 rgba(38, 106, 184, 0.53); | |
34 | +} | |
35 | + | |
36 | +.login-container-logo { | |
37 | + margin: 0; | |
38 | + background: url(../images/login_logo.png) no-repeat; | |
39 | + width: 401px; | |
40 | + height: 455px; | |
41 | + overflow: hidden; | |
42 | + float: left; | |
43 | +} | |
44 | + | |
45 | +.login-container-header { | |
46 | + font-size: 22px; | |
47 | + font-weight: 700; | |
48 | + text-align: left; | |
49 | + color: #545454; | |
50 | + letter-spacing: 1px; | |
51 | + text-align: center; | |
52 | + margin-bottom: 54px; | |
53 | +} | |
54 | + | |
55 | +.login-container-form { | |
56 | + margin-left: 401px; | |
57 | + height: 100%; | |
58 | + padding: 80px; | |
59 | +} | |
60 | + | |
61 | +.login-container-form .form-tip { | |
62 | + margin-left: 21.5px; | |
63 | + color: red; | |
64 | + margin-bottom: 10px; | |
65 | + padding: 5px 6px; | |
66 | + width: 296px; | |
67 | + background: #ffebeb; | |
68 | + border: 1px solid #faccc6; | |
69 | + font-size: 11px; | |
70 | + border-radius: 4px; | |
71 | +} | |
72 | + | |
73 | +.login-container-form .form-tip { | |
74 | + height: 32px; | |
75 | +} | |
76 | + | |
77 | +.login-container-form .form-tip p { | |
78 | + margin: 0 0 0 5px; | |
79 | + line-height: 23px; | |
80 | +} | |
81 | + | |
82 | +.login-container-form .form-tip p, | |
83 | +.login-container-form .form-tip span { | |
84 | + display: block; | |
85 | + float: left; | |
86 | + height: 20px; | |
87 | +} | |
88 | + | |
89 | +.stop { | |
90 | + background: url(../images/stop.png) no-repeat; | |
91 | + width: 20px; | |
92 | + height: 20px; | |
93 | +} | |
94 | + | |
95 | +.login-container-form .form-group { | |
96 | + width: 296px; | |
97 | + margin: 0 auto; | |
98 | + margin-top: 22px; | |
99 | +} | |
100 | + | |
101 | +.login-container-form :first-child { | |
102 | + margin-top: 0px; | |
103 | +} | |
104 | + | |
105 | +.login-container-form .has-feedback.feedback-left .form-control-feedback { | |
106 | + left: 0; | |
107 | + right: auto; | |
108 | + width: 38px; | |
109 | + height: 45px; | |
110 | + line-height: 45px; | |
111 | + z-index: 4; | |
112 | + color: #dcdcdc; | |
113 | + font-size: 16px; | |
114 | +} | |
115 | + | |
116 | +.login-container-form .has-feedback.feedback-left .micons-pwd { | |
117 | + font-size: 18px; | |
118 | + line-height: 48px; | |
119 | +} | |
120 | + | |
121 | +.login-container-form .has-feedback.feedback-left .form-control { | |
122 | + padding-left: 38px; | |
123 | + padding-right: 12px; | |
124 | + border: 1px solid #ebebeb; | |
125 | + border-radius: 4px; | |
126 | + height: 45px; | |
127 | + color: #999; | |
128 | + font-size: 16px; | |
129 | + letter-spacing: 1px; | |
130 | +} | |
131 | + | |
132 | +.login-container-form .has-feedback.feedback-left .form-control:hover, | |
133 | +.login-container-form .has-feedback.feedback-left .form-control:hover, | |
134 | +.login-container-form .has-feedback.feedback-left .form-control:focus { | |
135 | + border: 1px solid #3081c3; | |
136 | + outline: unset; | |
137 | + box-shadow: unset; | |
138 | +} | |
139 | + | |
140 | +.login-container-form .overhidden { | |
141 | + padding-left: 24px; | |
142 | + font-size: 14px; | |
143 | + color: #999999; | |
144 | + vertical-align: bottom; | |
145 | + line-height: 18px; | |
146 | +} | |
147 | + | |
148 | +.login-container-form .overhidden:hover { | |
149 | + color: #3081c3; | |
150 | +} | |
151 | + | |
152 | +.login-container-form .ftdms-checkbox span::before { | |
153 | + height: 15px; | |
154 | + width: 15px; | |
155 | + border-width: 1px; | |
156 | + top: 2px; | |
157 | +} | |
158 | + | |
159 | +#btn-login { | |
160 | + background: #3081c3; | |
161 | + height: 45px; | |
162 | + font-size: 16px; | |
163 | + font-weight: 400; | |
164 | + color: #ffffff; | |
165 | + letter-spacing: 1px; | |
166 | +} | |
167 | + | |
168 | +#btn-login:hover { | |
169 | + background: #2ba3f6; | |
170 | +} | |
171 | + | |
172 | +.form-control:focus, | |
173 | +.form-control:hover { | |
174 | + box-shadow: unset; | |
175 | + border: 1px solid #3081c3 !important; | |
176 | +} | |
177 | + | |
178 | +.form-control { | |
179 | + width: 100%; | |
180 | +} | |
181 | + | |
182 | +.btn-info,.btn-info:active { | |
183 | + border: 1px solid; | |
184 | +} | |
185 | + | |
186 | +.btn { | |
187 | + padding: 8px 12px; | |
188 | + border-radius: 2px; | |
189 | + outline: none !important; | |
190 | + -webkit-transition: 0.15s linear; | |
191 | + transition: 0.15s linear; | |
192 | +} | |
193 | + | |
194 | +button { | |
195 | + display: block; | |
196 | + width: 100%; | |
197 | + margin-bottom: 0; | |
198 | + line-height: 1.42857143; | |
199 | + text-align: center; | |
200 | + white-space: nowrap; | |
201 | + touch-action: manipulation; | |
202 | + cursor: pointer; | |
203 | + user-select: none; | |
204 | + font-family: inherit; | |
205 | + overflow: visible; | |
206 | + margin: 0; | |
207 | + font: inherit; | |
208 | + outline: none !important; | |
209 | +} | |
210 | + | |
211 | +.ftdms-checkbox span::before, | |
212 | +.ftdms-radio span::before { | |
213 | + content: ''; | |
214 | + position: absolute; | |
215 | + display: inline-block; | |
216 | + height: 18px; | |
217 | + width: 18px; | |
218 | + left: 0.5px; | |
219 | + top: 0px; | |
220 | + border: 2px solid #ebebeb; | |
221 | + -webkit-transition: all 0.1s; | |
222 | + -o-transition: all 0.1s; | |
223 | + transition: all 0.1s; | |
224 | +} | |
225 | + | |
226 | +:after, | |
227 | +:before { | |
228 | + -webkit-box-sizing: border-box; | |
229 | + -moz-box-sizing: border-box; | |
230 | + box-sizing: border-box; | |
193 | 231 | } |
\ No newline at end of file | ... | ... |
app/static/content/images/stop.png
0 → 100644

356 Bytes
1 | -if (typeof(dmap) == "undefined") var dmap = {}; | |
2 | -dmap.login = { | |
3 | - init: function() { | |
4 | - $('#btn-login').bind('click', function(e) { | |
5 | - let username = $("#username").val(); | |
6 | - let password = $("#password").val(); | |
7 | - | |
8 | - if (username.length <= 0 || password.length <= 0) { | |
9 | - tips.notify("用户名或密码不能为空", "danger", 1e3); | |
10 | - return false; | |
11 | - } | |
12 | - | |
13 | - $.post("authorize", { username: username, password: password }) | |
14 | - }); | |
15 | - } | |
1 | +if (typeof(dmap) == "undefined") var dmap = {}; | |
2 | +dmap.login = { | |
3 | + init: function() { | |
4 | + $('#btn-login').bind('click', function(e) { | |
5 | + let username = $("#username").val(); | |
6 | + let password = $("#password").val(); | |
7 | + | |
8 | + if (username.length <= 0 || password.length <= 0) { | |
9 | + tips.notify("用户名或密码不能为空", "danger", 1e3); | |
10 | + return false; | |
11 | + } | |
12 | + | |
13 | + $.post("authorize", { username: username, password: password }, function(data) { | |
14 | + if (!data.result) { | |
15 | + tips.notify("账号或密码错误", "danger", 1e3); | |
16 | + } | |
17 | + }) | |
18 | + }); | |
19 | + } | |
16 | 20 | }; |
\ No newline at end of file | ... | ... |
1 | -<html> | |
2 | - <head> | |
3 | - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
4 | - <title>DMap Server</title> | |
5 | - <link | |
6 | - rel="stylesheet" | |
7 | - type="text/css" | |
8 | - href="{{ url_for('static', filename = 'content/css/login.css') }}" | |
9 | - /> | |
10 | - <link | |
11 | - rel="stylesheet" | |
12 | - type="text/css" | |
13 | - href="{{ url_for('static', filename = 'content/css/font.css') }}" | |
14 | - /> | |
15 | - <link | |
16 | - rel="stylesheet" | |
17 | - type="text/css" | |
18 | - href="{{ url_for('static', filename = 'content/css/bootstrap.min.css') }}" | |
19 | - /> | |
20 | - <script src="{{ url_for('static',filename='content/js/jquery.min.js') }}"></script> | |
21 | - <script src="{{ url_for('static',filename='content/js/bootstrap-notify.min.js') }}"></script> | |
22 | - <script src="{{ url_for('static',filename='content/js/tips.js') }}"></script> | |
23 | - <script src="{{ url_for('static',filename='content/js/login.js') }}"></script> | |
24 | - </head> | |
25 | -</html> | |
26 | - | |
27 | -<div class="login"> | |
28 | - <div class="login-container"> | |
29 | - <p class="login-container-logo"></p> | |
30 | - <div class="login-container-form"> | |
31 | - <p class="login-container-header">广州城市信息研究所有限公司</p> | |
32 | - <form action="" method="post"> | |
33 | - <div class="form-group has-feedback feedback-left"> | |
34 | - <input | |
35 | - type="text" | |
36 | - placeholder="用户名" | |
37 | - maxlength="20" | |
38 | - autocomplete="off" | |
39 | - class="form-control border-info" | |
40 | - name="username" | |
41 | - id="username" | |
42 | - /> | |
43 | - <span class="micons-user form-control-feedback"></span> | |
44 | - </div> | |
45 | - | |
46 | - <div class="form-group has-feedback feedback-left"> | |
47 | - <input | |
48 | - type="password" | |
49 | - placeholder="密码" | |
50 | - maxlength="20" | |
51 | - autocomplete="off" | |
52 | - class="form-control border-info" | |
53 | - id="password" | |
54 | - name="password" | |
55 | - /> | |
56 | - <span class="micons-pwd form-control-feedback"></span> | |
57 | - </div> | |
58 | - | |
59 | - <div class="form-group"> | |
60 | - <button class="btn btn-block btn-info" type="submit" id="btn-login"> | |
61 | - 立即登录 | |
62 | - </button> | |
63 | - </div> | |
64 | - </form> | |
65 | - </div> | |
66 | - <div class="clear"></div> | |
67 | - </div> | |
68 | -</div> | |
69 | -<script> | |
70 | - $(function () {}) | |
71 | -</script> | |
1 | +<html> | |
2 | + <head> | |
3 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
4 | + <title>DMap Server</title> | |
5 | + <link | |
6 | + rel="stylesheet" | |
7 | + type="text/css" | |
8 | + href="{{ url_for('static', filename = 'content/css/login.css') }}" | |
9 | + /> | |
10 | + <link | |
11 | + rel="stylesheet" | |
12 | + type="text/css" | |
13 | + href="{{ url_for('static', filename = 'content/css/font.css') }}" | |
14 | + /> | |
15 | + <link | |
16 | + rel="stylesheet" | |
17 | + type="text/css" | |
18 | + href="{{ url_for('static', filename = 'content/css/bootstrap.min.css') }}" | |
19 | + /> | |
20 | + <script src="{{ url_for('static',filename='content/js/jquery.min.js') }}"></script> | |
21 | + <script src="{{ url_for('static',filename='content/js/bootstrap-notify.min.js') }}"></script> | |
22 | + <script src="{{ url_for('static',filename='content/js/tips.js') }}"></script> | |
23 | + <script src="{{ url_for('static',filename='content/js/login.js') }}"></script> | |
24 | + </head> | |
25 | +</html> | |
26 | + | |
27 | +<div class="login"> | |
28 | + <div class="login-container"> | |
29 | + <p class="login-container-logo"></p> | |
30 | + <div class="login-container-form"> | |
31 | + <p class="login-container-header">广州城市信息研究所有限公司</p> | |
32 | + | |
33 | + {%if error%} | |
34 | + <div class="form-tip"> | |
35 | + <span class="stop"></span> | |
36 | + <p>{{error}}</p> | |
37 | + </div> | |
38 | + {% endif %} | |
39 | + | |
40 | + <form action="" method="post"> | |
41 | + <div class="form-group has-feedback feedback-left"> | |
42 | + <input | |
43 | + type="text" | |
44 | + placeholder="用户名" | |
45 | + maxlength="20" | |
46 | + autocomplete="off" | |
47 | + class="form-control border-info" | |
48 | + name="username" | |
49 | + id="username" | |
50 | + /> | |
51 | + <span class="micons-user form-control-feedback"></span> | |
52 | + </div> | |
53 | + | |
54 | + <div class="form-group has-feedback feedback-left"> | |
55 | + <input | |
56 | + type="password" | |
57 | + placeholder="密码" | |
58 | + maxlength="20" | |
59 | + autocomplete="off" | |
60 | + class="form-control border-info" | |
61 | + id="password" | |
62 | + name="password" | |
63 | + /> | |
64 | + <span class="micons-pwd form-control-feedback"></span> | |
65 | + </div> | |
66 | + | |
67 | + <div class="form-group"> | |
68 | + <button class="btn btn-block btn-info" type="submit" id="btn-login"> | |
69 | + 立即登录 | |
70 | + </button> | |
71 | + </div> | |
72 | + </form> | |
73 | + </div> | |
74 | + <div class="clear"></div> | |
75 | + </div> | |
76 | +</div> | |
77 | +<script> | |
78 | + $(function () {}) | |
79 | +</script> | ... | ... |
请
注册
或
登录
后发表评论