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
1154c4b8
Commit
1154c4b8
authored
12 years ago
by
David Ormsbee
Browse files
Options
Downloads
Patches
Plain Diff
auto-resend activation email if they try to log in and aren't activated
parent
01ac01b6
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/djangoapps/student/views.py
+15
-9
15 additions, 9 deletions
common/djangoapps/student/views.py
with
15 additions
and
9 deletions
common/djangoapps/student/views.py
+
15
−
9
View file @
1154c4b8
...
...
@@ -262,10 +262,15 @@ def login_user(request, error=""):
try_change_enrollment
(
request
)
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
True
}))
log
.
warning
(
"
Login failed - Account not active for user {0}
"
.
format
(
username
))
log
.
warning
(
"
Login failed - Account not active for user {0}, resending activation
"
.
format
(
username
))
reactivation_email_for_user
(
user
)
not_activated_msg
=
"
This account has not been activated. We have
"
+
\
"
sent another activation message. Please check your
"
+
\
"
e-mail for the activation instructions.
"
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
False
,
'
value
'
:
'
This account has not been activated. Please check your e-mail for the activation instructions.
'
}))
'
value
'
:
not_activated_msg
}))
@ensure_csrf_cookie
...
...
@@ -540,7 +545,6 @@ def password_reset(request):
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
False
,
'
error
'
:
'
Invalid e-mail
'
}))
@ensure_csrf_cookie
def
reactivation_email
(
request
):
'''
Send an e-mail to reactivate a deactivated account, or to
...
...
@@ -551,21 +555,23 @@ def reactivation_email(request):
except
User
.
DoesNotExist
:
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
False
,
'
error
'
:
'
No inactive user with this e-mail exists
'
}))
return
reactivation_email_for_user
(
user
)
def
reactivation_email_for_user
(
user
):
reg
=
Registration
.
objects
.
get
(
user
=
user
)
reg
.
register
(
user
)
d
=
{
'
name
'
:
U
ser
P
rofile
.
get
(
user
=
user
).
name
,
'
key
'
:
r
.
activation_key
}
d
=
{
'
name
'
:
u
ser
.
p
rofile
.
name
,
'
key
'
:
r
eg
.
activation_key
}
subject
=
render_to_string
(
'
r
eactivation_email_subject.txt
'
,
d
)
subject
=
render_to_string
(
'
e
mails/
activation_email_subject.txt
'
,
d
)
subject
=
''
.
join
(
subject
.
splitlines
())
message
=
render_to_string
(
'
r
eactivation_email.txt
'
,
d
)
message
=
render_to_string
(
'
e
mails/
activation_email.txt
'
,
d
)
res
=
user
.
email_user
(
subject
,
message
,
settings
.
DEFAULT_FROM_EMAIL
)
return
HttpResponse
(
json
.
dumps
({
'
success
'
:
True
}))
@ensure_csrf_cookie
def
change_email_request
(
request
):
...
...
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