Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
02fd123a
Commit
02fd123a
authored
May 21, 2020
by
Vladislav Rykov
Browse files
flashing icorporated
parent
ca4000a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
02fd123a
No preview for this file type
app/app/templates/general_layout.html
View file @
02fd123a
...
...
@@ -33,6 +33,19 @@
</head>
{% block content %} {% endblock %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div
class=
"alert alert-{{ category }} alert-dismissible show fade"
role=
"alert"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<footer
class=
"py-5"
>
<div
class=
"container"
>
...
...
app/app/templates/new/public/register.html
View file @
02fd123a
...
...
@@ -86,7 +86,7 @@
<div
class=
"input-group-prepend"
>
<span
class=
"input-group-text"
><i
class=
"ni ni-single-02"
></i></span>
</div>
<input
class=
"form-control"
maxlength=
"30"
placeholder=
"Username"
type=
"text"
id=
"username"
name=
"username"
>
<input
class=
"form-control"
maxlength=
"30"
placeholder=
"Username"
type=
"text"
id=
"username"
name=
"username"
required
>
</div>
</div>
<div
class=
"form-group"
>
...
...
app/app/views.py
View file @
02fd123a
...
...
@@ -41,7 +41,7 @@ def index():
@
app
.
route
(
'/register'
,
methods
=
[
'GET'
,
'POST'
])
def
signup
():
def
register
():
if
request
.
method
==
'GET'
:
if
'role'
in
session
and
session
[
'role'
]
==
'admin'
:
return
render_template
(
'old/admin/signup.html'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
...
...
@@ -56,11 +56,11 @@ def signup():
password
=
request
.
form
[
'password'
].
encode
(
'utf-8'
)
if
(
username
==
''
or
password
==
''
):
f
eedback
=
'Username or password fields cannot be empty'
return
re
nder_template
(
'old/public/signup.html'
,
feedback
=
feedback
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
f
lash
(
'Username or password fields cannot be empty'
,
'danger'
)
return
re
direct
(
url_for
(
'register'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
)
elif
(
len
(
password
)
<
8
):
flash
(
'Password length must be at least 8 characters.'
,
'danger'
)
return
redirect
(
request
.
url
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
return
redirect
(
url_for
(
'register'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
)
else
:
role
=
'user'
if
'role'
in
request
.
form
and
request
.
form
[
'role'
]
==
'administrator'
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment