Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
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
Hsin-Yu Chien
edx-platform-release
Commits
7c73d7ef
Commit
7c73d7ef
authored
13 years ago
by
Piotr Mitros
Browse files
Options
Downloads
Patches
Plain Diff
Non-working code; Cale needs a commit/push
--HG-- branch : pmitros-name-change
parent
cbfeb79e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
student/models.py
+1
-1
1 addition, 1 deletion
student/models.py
student/views.py
+14
-1
14 additions, 1 deletion
student/views.py
urls.py
+3
-2
3 additions, 2 deletions
urls.py
with
18 additions
and
4 deletions
student/models.py
+
1
−
1
View file @
7c73d7ef
...
...
@@ -65,7 +65,7 @@ class PendingNameChange(models.Model):
class
PendingEmailChange
(
models
.
Model
):
user
=
models
.
OneToOneField
(
User
,
unique
=
True
,
db_index
=
True
)
new_email
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
)
new_email
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
#cache_relation(User.profile)
...
...
This diff is collapsed.
Click to expand it.
student/views.py
+
14
−
1
View file @
7c73d7ef
...
...
@@ -264,7 +264,20 @@ def change_email_request(request):
## Maske sure it checks for existing e-mail conflicts
if
not
request
.
user
.
is_authenticated
:
raise
Http404
pass
if
not
request
.
user
.
check_password
(
request
.
POST
[
'
password
'
]):
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
False
,
'
error
'
:
'
Invalid password
'
}))
new_email
=
request
.
POST
[
'
new_email
'
]
if
len
(
User
.
objects
.
filter
(
email
=
new_email
))
!=
0
:
## CRITICAL TODO: Handle case for e-mails
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
False
,
'
error
'
:
'
An account with this e-mail already exists.
'
}))
request
.
POST
[
'
new_email
'
]
@ensure_csrf_cookie
def
change_email_confirm
(
request
):
...
...
This diff is collapsed.
Click to expand it.
urls.py
+
3
−
2
View file @
7c73d7ef
...
...
@@ -8,6 +8,8 @@ import django.contrib.auth.views
# admin.autodiscover()
urlpatterns
=
(
''
,
url
(
r
'
^email_change$
'
,
'
student.views.change_email_request
'
),
url
(
r
'
^email_confirm$
'
,
'
student.views.change_email_confirm
'
),
url
(
r
'
^gradebook$
'
,
'
courseware.views.gradebook
'
),
url
(
r
'
^event$
'
,
'
track.views.user_track
'
),
url
(
r
'
^t/(?P<template>[^/]*)$
'
,
'
static_template_view.views.index
'
),
...
...
@@ -17,9 +19,8 @@ urlpatterns = ('',
url
(
r
'
^login/(?P<error>[^/]*)$
'
,
'
student.views.login_user
'
),
url
(
r
'
^create_account$
'
,
'
student.views.create_account
'
),
url
(
r
'
^activate/(?P<key>[^/]*)$
'
,
'
student.views.activate_account
'
),
url
(
r
'
^reactivate/(?P<key>[^/]*)$
'
,
'
student.views.reactivation_email
'
),
url
(
r
'
^$
'
,
'
student.views.index
'
),
# url(r'^password_reset/$', 'django.contrib.auth.views.password_reset',
# dict(from_email='registration@mitx.mit.edu'),name='auth_password_reset'),
url
(
r
'
^password_reset/$
'
,
'
student.views.password_reset
'
),
url
(
r
'
^password_change/$
'
,
django
.
contrib
.
auth
.
views
.
password_change
,
name
=
'
auth_password_change
'
),
url
(
r
'
^password_change_done/$
'
,
django
.
contrib
.
auth
.
views
.
password_change_done
,
name
=
'
auth_password_change_done
'
),
...
...
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