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
01b2c488
Commit
01b2c488
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Add shib var capture
parent
2b703d3d
No related branches found
No related tags found
1 merge request
!2
Feat update ui (pre react)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/__init__.py
+18
-24
18 additions, 24 deletions
app/__init__.py
with
18 additions
and
24 deletions
app/__init__.py
+
18
−
24
View file @
01b2c488
...
@@ -8,46 +8,40 @@ import vars
...
@@ -8,46 +8,40 @@ import vars
import
uuid
import
uuid
from
flask
import
Flask
,
redirect
,
url_for
,
request
,
render_template
,
flash
,
session
from
flask
import
Flask
,
redirect
,
url_for
,
request
,
render_template
,
flash
,
session
from
flask_bootstrap
import
Bootstrap
from
flask_bootstrap
import
Bootstrap
from
flask_sso
import
SSO
def
create_app
(
config_name
):
def
create_app
(
config_name
):
app
=
Flask
(
__name__
)
# initialization of the flask app
app
=
Flask
(
__name__
)
# initialization of the flask app
Bootstrap
(
app
)
# allowing app to use bootstrap
Bootstrap
(
app
)
# allowing app to use bootstrap
SSO_ATTRIBUTE_MAP
=
{
def
get_shib_user
():
'
ADFS_LOGIN
'
:
(
True
,
'
username
'
),
session
[
'
user
'
]
=
{
'
ADFS_FULLNAME
'
:
(
True
,
'
fullname
'
),
"
username
"
:
request
.
environ
.
get
(
"
HTTP_UID
"
),
'
ADFS_EMAIL
'
:
(
True
,
'
email
'
)
"
fullname
"
:
request
.
environ
.
get
(
"
HTTP_DISPLAYNAME
"
),
}
"
email
"
:
request
.
environ
.
get
(
"
HTTP_MAIL
"
)
app
.
config
.
setdefault
(
'
SSO_ATTRIBUTE_MAP
'
,
SSO_ATTRIBUTE_MAP
)
}
app
.
config
.
setdefault
(
'
SSO_LOGIN_URL
'
,
'
/login
'
)
shib
=
SSO
(
app
=
app
)
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
# initial route to display the reg page
@shib.login_handler
def
login
(
user_info
):
session
[
'
user
'
]
=
user_info
return
redirect
(
'
/
'
)
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
# initial route to display the reg page
def
index
():
def
index
():
if
'
uid
'
not
in
session
:
if
'
uid
'
not
in
session
:
session
[
'
uid
'
]
=
str
(
uuid
.
uuid4
())
session
[
'
uid
'
]
=
str
(
uuid
.
uuid4
())
if
"
redir
"
in
request
.
args
and
'
return_url
'
not
in
session
:
# check for redir arg in url
if
'
user
'
not
in
session
:
get_shib_user
()
if
"
redir
"
in
request
.
args
and
'
return_url
'
not
in
session
:
# check for redir arg in url
session
[
'
return_url
'
]
=
request
.
args
.
get
(
"
redir
"
)
session
[
'
return_url
'
]
=
request
.
args
.
get
(
"
redir
"
)
elif
"
redir
"
not
in
request
.
args
and
'
return_url
'
not
in
session
:
elif
"
redir
"
not
in
request
.
args
and
'
return_url
'
not
in
session
:
session
[
'
return_url
'
]
=
vars
.
default_referrer
session
[
'
return_url
'
]
=
vars
.
default_referrer
else
:
else
:
session
[
'
return_url
'
]
=
request
.
referrer
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'),
fullname
=
session
[
'
user
'
].
get
(
'
fullname
'
),
email
=
session
[
'
user
'
].
get
(
'
email
'
),
# referrer=session['return_url'])
referrer
=
session
[
'
return_url
'
])
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
],
referrer
=
session
[
'
return_url
'
])
# misc page error catching
# misc page error catching
@app.errorhandler
(
403
)
@app.errorhandler
(
403
)
...
...
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