Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Flask_User_Reg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mitchell Moore
Flask_User_Reg
Commits
57ce1d41
Commit
57ce1d41
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-form-functionality' into 'master'
Fix form functionality See merge request
!20
parents
146d845b
051428a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Fix form functionality
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/__init__.py
+18
-19
18 additions, 19 deletions
app/__init__.py
app/templates/auth/SignUp.html
+11
-10
11 additions, 10 deletions
app/templates/auth/SignUp.html
app/templates/auth/base.html
+1
-1
1 addition, 1 deletion
app/templates/auth/base.html
with
30 additions
and
30 deletions
app/__init__.py
+
18
−
19
View file @
57ce1d41
...
...
@@ -10,7 +10,9 @@ import time
# third-party imports
from
flask
import
Flask
,
redirect
,
url_for
,
request
,
render_template
,
flash
from
flask_wtf
import
FlaskForm
from
flask_bootstrap
import
Bootstrap
from
wtforms
import
StringField
,
SubmitField
,
validators
def
create_app
(
config_name
):
...
...
@@ -21,30 +23,27 @@ def create_app(config_name):
global
return_url
return_url
=
''
class
MainForm
(
FlaskForm
):
fullname
=
StringField
(
'
Full Name:
'
,
[
validators
.
DataRequired
(),
])
submit
=
SubmitField
(
'
Submit
'
)
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
index
():
global
return_url
user
=
request
.
remote_user
if
request
.
method
==
'
GET
'
:
global
return_url
if
"
redir
"
in
request
.
args
:
return_url
=
request
.
args
.
get
(
"
redir
"
)
or
"
/pun/sys/dashboard
"
return
render_template
(
"
auth/SignUp.html
"
,
user
=
user
)
if
request
.
method
==
'
POST
'
:
name
=
request
.
form
[
'
name
'
]
if
"
redir
"
in
request
.
args
:
return_url
=
request
.
args
.
get
(
"
redir
"
)
or
"
/pun/sys/dashboard
"
if
name
!=
""
:
username
=
False
form
=
MainForm
()
if
form
.
is_submitted
():
username
=
form
.
fullname
.
data
form
.
fullname
.
data
=
''
return
redirect
(
url_for
(
'
success
'
,
username
=
str
(
user
),
fullname
=
name
))
return
redirect
(
url_for
(
'
success
'
,
username
=
str
(
user
),
fullname
=
user
name
))
else
:
return
render_template
(
"
auth/SignUp.html
"
,
user
=
user
)
return
render_template
(
'
auth/SignUp.html
'
,
form
=
form
,
user
=
user
)
@app.route
(
'
/success/<username>/<fullname>
'
)
def
success
(
username
,
fullname
):
...
...
@@ -62,8 +61,8 @@ def create_app(config_name):
return
redirect
(
return_url
,
302
)
except
:
flash
(
"
Registration Failed
"
)
return
redirect
(
return_url
)
flash
(
"
Registration Failed
. Please try again.
"
)
return
redirect
(
url_for
(
'
index
'
)
)
@app.errorhandler
(
403
)
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/SignUp.html
+
11
−
10
View file @
57ce1d41
{% extends "auth/base.html" %}
<html
class=
"gr__rc_uab_edu"
>
{% block title %} User Regist
e
r {% endblock %}
{% block title %} User Registr
ation
{% endblock %}
{% block head %}
{{ super() }}
<style
type=
"text/css"
>
...
...
@@ -46,20 +46,22 @@
</div>
</nav>
</header>
<div
class=
"container content"
role=
"main"
style=
"
width: 800;
"
>
<div
class=
"container content"
role=
"main"
style=
"width: 625px"
>
<div
class=
"col-md-12"
>
<div
style=
"position:relative;"
>
<img
alt=
"logo"
height=
"100"
style=
"margin-bottom: 20px"
src=
"/register/static/img/cheaha-logo-a605de0aecd3006b82a5ee30a6d0cb8cd9bf8b7e836296cc293eac746a4c2b11.png"
>
<a
href=
"https://tinyurl.com/cheahaAL"
target=
"_blank"
>
<div
style=
"float:left;position:absolute;display:block;left:310px;top:-6px;padding:10px 20px;"
>
</div>
</a>
</div>
<img
class=
"header-logo"
height=
"100"
style=
"margin-bottom: 20px"
src=
"/register/static/img/cheaha-logo-a605de0aecd3006b82a5ee30a6d0cb8cd9bf8b7e836296cc293eac746a4c2b11.png"
>
<h2>
Hello, {{ user }}!
</h2>
<form
action=
"."
method=
"post"
>
<div
class=
"signUpContainer"
>
<label
for=
"name"
><b>
F
ull
N
ame
:
<br></b></label>
<input
class=
"form-control"
type=
"text"
placeholder=
"Enter Full Name"
name=
"name"
required
>
<input
class=
"btn btn-primary btn-block"
type=
"submit"
value=
"submit"
>
<label
><b>
{{ form.f
ull
n
ame
.label }}
<br></b></label>
{{ form.fullname(
class
_
="form-control"
,
placeholder="Enter Full Name"
) }}
{{ form.submit(
class
_
="btn btn-primary btn-block"
) }}
{% with messages = get_flashed_messages() %}
{% if messages %}
...
...
@@ -74,7 +76,6 @@
</div>
</form>
</div>
</div>
{% endblock %}
</body>
{% block footer %}
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/base.html
+
1
−
1
View file @
57ce1d41
...
...
@@ -3,7 +3,7 @@
<head>
{% block head %}
<link
rel=
"stylesheet"
href=
"/register/static/style/application.css"
>
<title>
{% block title %}{% endblock %}
- My Webpage
</title>
<title>
{% block title %}{% endblock %}
</title>
{% endblock %}
</head>
<body>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment