Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
1154c4b8
Commit
1154c4b8
authored
Oct 13, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto-resend activation email if they try to log in and aren't activated
parent
01ac01b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
common/djangoapps/student/views.py
+15
-9
No files found.
common/djangoapps/student/views.py
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'
:
UserProfile
.
get
(
user
=
user
)
.
name
,
'key'
:
r
.
activation_key
}
d
=
{
'name'
:
user
.
profile
.
name
,
'key'
:
reg
.
activation_key
}
subject
=
render_to_string
(
'
re
activation_email_subject.txt'
,
d
)
subject
=
render_to_string
(
'
emails/
activation_email_subject.txt'
,
d
)
subject
=
''
.
join
(
subject
.
splitlines
())
message
=
render_to_string
(
'
re
activation_email.txt'
,
d
)
message
=
render_to_string
(
'
emails/
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
):
...
...
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