Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8ec9138e
authored
Jun 18, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: error msg for sp login wo/ email, fixes #129
parent
76a93346
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
school/tests.py
+1
-1
school/views.py
+6
-2
No files found.
school/tests.py
View file @
8ec9138e
...
...
@@ -215,4 +215,4 @@ class ViewTestCase(TestCase):
def
test_login_without_email
(
self
):
del
self
.
http_headers
[
'email'
]
resp
=
self
.
client
.
get
(
'/login/'
,
follow
=
True
,
**
self
.
http_headers
)
print
resp
.
status_code
self
.
assertEqual
(
403
,
resp
.
status_code
)
school/views.py
View file @
8ec9138e
from
datetime
import
datetime
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
PermissionDenied
,
ValidationError
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
,
Group
as
AGroup
...
...
@@ -45,7 +45,11 @@ def login(request):
user
.
set_unusable_password
()
user
.
first_name
=
request
.
META
[
'givenName'
]
user
.
last_name
=
request
.
META
[
'sn'
]
user
.
email
=
request
.
META
[
'email'
]
try
:
user
.
email
=
request
.
META
[
'email'
]
except
KeyError
:
messages
.
error
(
request
,
_
(
"The identity provider did not pass the mandatory e-mail data."
))
raise
PermissionDenied
()
user
.
save
()
p
,
created
=
Person
.
objects
.
get_or_create
(
code
=
user
.
username
)
p
.
user_id
=
user
.
id
...
...
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