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
b2db05fc
Commit
b2db05fc
authored
Dec 13, 2013
by
Chris Rossi
Committed by
Diana Huang
Jan 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial stab at placeholder email template.
parent
fc17ed26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
1 deletions
+71
-1
linkedin-login.py
+36
-0
lms/djangoapps/linkedin/management/commands/mailusers.py
+10
-1
lms/djangoapps/linkedin/templates/linkedin_email.html
+25
-0
No files found.
linkedin-login.py
0 → 100644
View file @
b2db05fc
import
urllib2
import
uuid
CLIENT_ID
=
"77zv1vf44fo92m"
CLIENT_SECRET
=
"1M3wZUNA2aYHldbv"
REDIRECT_URI
=
"http://www.edx.org"
STATE
=
uuid
.
uuid4
()
SCOPE
=
"
%20
"
.
join
([
"r_basicprofile"
,
"r_fullprofile"
,
"r_emailaddress"
,
"r_network"
,
"r_contactinfo"
,
"rw_nus"
,
"rw_company_admin"
,
"rw_groups"
,
"w_messages"
])
print
"Go here:"
print
(
"https://www.linkedin.com/uas/oauth2/authorization?response_type=code"
"&client_id=
%
s&state=
%
s&redirect_uri=
%
s&scope=
%
s"
%
(
CLIENT_ID
,
STATE
,
REDIRECT_URI
,
SCOPE
))
print
"Enter authcode: "
,
code
=
raw_input
()
url
=
(
"https://www.linkedin.com/uas/oauth2/accessToken"
"?grant_type=authorization_code"
"&code=
%
s&redirect_uri=
%
s&client_id=
%
s&client_secret=
%
s"
%
(
code
,
REDIRECT_URI
,
CLIENT_ID
,
CLIENT_SECRET
))
try
:
print
urllib2
.
urlopen
(
url
)
.
read
()
except
urllib2
.
HTTPError
,
e
:
print
"!!ERROR!!"
print
e
print
e
.
read
()
lms/djangoapps/linkedin/management/commands/mailusers.py
View file @
b2db05fc
...
...
@@ -5,7 +5,10 @@ LinkedIn profiles.
import
json
from
courseware.courses
import
get_course_by_id
from
django.core.management.base
import
BaseCommand
from
django.template
import
Context
from
django.template.loader
import
get_template
from
optparse
import
make_option
from
certificates.models
import
GeneratedCertificate
...
...
@@ -69,4 +72,10 @@ def send_email(user, certificate):
Email a user that recently earned a certificate, inviting them to post their
certificate on their LinkedIn profile.
"""
print
"EMAIL: "
,
user
,
certificate
template
=
get_template
(
"linkedin_email.html"
)
course
=
get_course_by_id
(
certificate
.
course_id
)
context
=
Context
({
'student_name'
:
user
.
profile
.
name
,
'course_name'
:
'XXX'
,
'url'
:
'#'
})
print
template
.
render
(
context
)
lms/djangoapps/linkedin/templates/linkedin_email.html
0 → 100644
View file @
b2db05fc
{% load i18n %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<meta
name=
"viewport"
content=
"initial-scale=1.0"
>
</head>
<body>
<p>
{% blocktrans with name=student_name %}
Dear {{student_name}},
{% endblocktrans %}
</p>
<p>
{% blocktrans with name=course_name %}
Congratulations on earning your certificate in {{course_name}}!
Since you have an account on LinkedIn, you can display your hard earned
credential for your colleagues to see. Click the button below to add the
certificate to your profile.
{% endblocktrans %}
</p>
<p><a
href=
"{{url}}"
>
<span>
in
<span>
{% blocktrans %}Add to profile{% endblocktrans %}
</a></p>
</body>
</html>
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