Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account-app
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
rc
account-app
Commits
0df23095
Commit
0df23095
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Work pre openstack crash
parent
88a8a6a0
No related branches found
No related tags found
1 merge request
!2
Feat update ui (pre react)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/__init__.py
+26
-8
26 additions, 8 deletions
app/__init__.py
app/templates/auth/SignUp.html
+1
-1
1 addition, 1 deletion
app/templates/auth/SignUp.html
vars.py
+11
-3
11 additions, 3 deletions
vars.py
with
38 additions
and
12 deletions
app/__init__.py
+
26
−
8
View file @
0df23095
...
...
@@ -3,6 +3,7 @@
# local imports
from
__future__
import
print_function
import
vars
import
time
# third-party imports
import
uuid
...
...
@@ -14,21 +15,37 @@ def create_app(config_name):
app
=
Flask
(
__name__
)
# initialization of the flask app
Bootstrap
(
app
)
# allowing app to use bootstrap
def
get_shib_user
():
session
[
'
user
'
]
=
{
"
username
"
:
request
.
environ
.
get
(
"
HTTP_UID
"
),
"
fullname
"
:
request
.
environ
.
get
(
"
HTTP_DISPLAYNAME
"
),
"
email
"
:
request
.
environ
.
get
(
"
HTTP_MAIL
"
)
def
get_authorized_user
():
username_keys
=
list
(
filter
(
lambda
key
:
(
request
.
environ
.
get
(
key
)
is
not
None
),
vars
.
username_keys
))
fullname_keys
=
list
(
filter
(
lambda
key
:
(
request
.
environ
.
get
(
key
)
is
not
None
),
vars
.
fullname_keys
))
email_keys
=
list
(
filter
(
lambda
key
:
(
request
.
environ
.
get
(
key
)
is
not
None
),
vars
.
email_keys
))
user
=
{
"
username
"
:
(
request
.
environ
.
get
(
username_keys
[
0
])
if
len
(
username_keys
)
>
0
else
None
),
"
fullname
"
:
(
request
.
environ
.
get
(
fullname_keys
[
0
])
if
len
(
fullname_keys
)
>
0
else
None
),
"
email
"
:
(
request
.
environ
.
get
(
email_keys
[
0
])
if
len
(
email_keys
)
>
0
else
None
),
}
return
user
,
user
.
get
(
"
username
"
)
is
not
None
,
user
.
get
(
"
fullname
"
)
is
not
None
,
user
.
get
(
"
email
"
)
is
not
None
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
# initial route to display the reg page
def
index
():
# test block
request
.
environ
[
"
HTTP_UID
"
]
=
"
mmoo97
"
request
.
environ
[
"
HTTP_DISPLAYNAME
"
]
=
"
Mitchell Moore
"
request
.
environ
[
"
HTTP_MAIL
"
]
=
"
mmoo97@uab.edu
"
for
key
in
sorted
(
request
.
environ
.
keys
()):
print
(
key
)
# end test block
if
'
uid
'
not
in
session
:
session
[
'
uid
'
]
=
str
(
uuid
.
uuid4
())
if
'
user
'
not
in
session
:
get_shib
_user
()
session
[
"
user
"
],
session
[
"
is_username
"
],
session
[
"
is_fullname
"
],
session
[
"
is_email
"
]
=
get_authorized
_user
()
if
"
redir
"
in
request
.
args
:
# check for redir arg in url
session
[
'
return_url
'
]
=
request
.
args
.
get
(
"
redir
"
)
...
...
@@ -39,9 +56,10 @@ def create_app(config_name):
else
:
session
[
'
return_url
'
]
=
request
.
referrer
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
],
username
=
session
[
'
user
'
].
get
(
'
username
'
),
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
],
username
=
session
[
'
user
'
].
get
(
'
username
'
),
fullname
=
session
[
'
user
'
].
get
(
'
fullname
'
),
email
=
session
[
'
user
'
].
get
(
'
email
'
),
referrer
=
session
[
'
return_url
'
],
cancel_
link
=
vars
.
default_referrer
)
referrer
=
session
[
'
return_url
'
],
cancel_
url
=
vars
.
default_referrer
)
# misc page error catching
@app.errorhandler
(
403
)
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/SignUp.html
+
1
−
1
View file @
0df23095
...
...
@@ -106,7 +106,7 @@
<div
class=
"row-no-gutters"
>
<div
class=
"col-lg-6"
>
<input
class=
"btn btn-danger btn-block"
id=
"cancel"
name=
"cancel"
type=
"button"
value=
"Cancel"
onclick=
"window.location.replace('{{
referrer
}}');"
>
<input
class=
"btn btn-danger btn-block"
id=
"cancel"
name=
"cancel"
type=
"button"
value=
"Cancel"
onclick=
"window.location.replace('{{
cancel_url
}}');"
>
</div>
<div
class=
"col-lg-6"
>
<input
class=
"btn btn-primary btn-block"
id=
"submit"
name=
"submit"
type=
"button"
value=
"Submit"
onclick=
"request_account()"
>
...
...
This diff is collapsed.
Click to expand it.
vars.py
+
11
−
3
View file @
0df23095
id
=
''
password
=
''
key
=
''
# RabbitMQ vars
id
=
'
test
'
password
=
'
test
'
key
=
'
sekey576
'
broker_url
=
'
amqp://
'
+
id
+
'
:
'
+
password
+
'
@ohpc:5672/
'
message_queue
=
broker_url
+
'
socketio
'
# App vars
default_referrer
=
"
https://docs.uabgrid.uab.edu/wiki/Cheaha_Quick_Start
"
# Form vars
username_keys
=
[
"
HTTP_UID
"
]
fullname_keys
=
[
"
OTHER_NAME
"
,
"
HTTP_DISPLAYNAME
"
]
email_keys
=
[
"
HTTP_MAIL
"
]
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