Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flowspy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
flowspy
Commits
b969de46
Commit
b969de46
authored
Jan 23, 2012
by
Leonidas Poulopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved peer lookup and user profile creation into custom user_login function
parent
398213bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
flowspec/views.py
flowspec/views.py
+19
-11
No files found.
flowspec/views.py
View file @
b969de46
...
...
@@ -27,6 +27,8 @@ from django.forms.models import model_to_dict
from
flowspy.flowspec.forms
import
*
from
flowspy.flowspec.models
import
*
from
flowspy.peers.models
import
*
from
registration.models
import
RegistrationProfile
from
copy
import
deepcopy
...
...
@@ -213,9 +215,9 @@ def user_login(request):
try
:
error_username
=
False
error_orgname
=
False
error_
affiliation
=
False
error_
entitlement
=
False
error_mail
=
False
has_
affiliation
=
False
has_
entitlement
=
False
error
=
''
username
=
request
.
META
[
'HTTP_EPPN'
]
if
not
username
:
...
...
@@ -224,11 +226,11 @@ def user_login(request):
lastname
=
request
.
META
[
'HTTP_SHIB_PERSON_SURNAME'
]
mail
=
request
.
META
[
'HTTP_SHIB_INETORGPERSON_MAIL'
]
organization
=
request
.
META
[
'HTTP_SHIB_HOMEORGANIZATION'
]
affiliation
=
request
.
META
[
'HTTP_SHIB_EP_ENTITLEMENT'
]
if
settings
.
SHIB_AUTH_
AFFILIATION
in
affiliation
.
split
(
";"
):
has_
affiliation
=
True
if
not
has_
affiliation
:
error_
affiliation
=
True
entitlement
=
request
.
META
[
'HTTP_SHIB_EP_ENTITLEMENT'
]
if
settings
.
SHIB_AUTH_
ENTITLEMENT
in
entitlement
.
split
(
";"
):
has_
entitlement
=
True
if
not
has_
entitlement
:
error_
entitlement
=
True
if
not
organization
:
error_orgname
=
True
if
not
mail
:
...
...
@@ -237,11 +239,11 @@ def user_login(request):
error
=
"Your idP should release the HTTP_EPPN attribute towards this service<br>"
if
error_orgname
:
error
=
error
+
"Your idP should release the HTTP_SHIB_HOMEORGANIZATION attribute towards this service<br>"
if
error_
affiliation
:
if
error_
entitlement
:
error
=
error
+
"Your idP should release an appropriate HTTP_SHIB_EP_ENTITLEMENT attribute towards this service<br>"
if
error_mail
:
error
=
error
+
"Your idP should release the HTTP_SHIB_INETORGPERSON_MAIL attribute towards this service"
if
error_username
or
error_orgname
or
error_
affiliation
or
error_mail
:
if
error_username
or
error_orgname
or
error_
entitlement
or
error_mail
:
return
render_to_response
(
'error.html'
,
{
'error'
:
error
,
"missing_attributes"
:
True
},
context_instance
=
RequestContext
(
request
))
try
:
...
...
@@ -249,8 +251,14 @@ def user_login(request):
user_exists
=
True
except
:
user_exists
=
False
user
=
authenticate
(
username
=
username
,
firstname
=
firstname
,
lastname
=
lastname
,
mail
=
mail
,
organization
=
organization
,
affiliation
=
affiliation
)
user
=
authenticate
(
username
=
username
,
firstname
=
firstname
,
lastname
=
lastname
,
mail
=
mail
)
if
user
is
not
None
:
try
:
peer
=
Peer
.
objects
.
get
(
domain_name
=
organization
)
up
=
UserProfile
.
objects
.
get_or_create
(
user
=
user
,
peer
=
peer
)
except
:
error
=
"Your organization's domain name does not match our peers' domain names<br>Please contact Helpdesk to resolve this issue"
return
render_to_response
(
'error.html'
,
{
'error'
:
error
})
if
not
user_exists
:
user_activation_notify
(
user
)
if
user
.
is_active
:
...
...
@@ -286,7 +294,7 @@ def user_activation_notify(user):
send_new_mail
(
settings
.
EMAIL_SUBJECT_PREFIX
+
subject
,
message
,
settings
.
SERVER_EMAIL
,
get_peer_techc_mails
(
user
),
[])
@
login_required
@
never_cache
def
add_rate_limit
(
request
):
...
...
Write
Preview
Markdown
is supported
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