Initial stab at placeholder email template.
This commit is contained in:
36
linkedin-login.py
Normal file
36
linkedin-login.py
Normal file
@@ -0,0 +1,36 @@
|
||||
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()
|
||||
@@ -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)
|
||||
|
||||
25
lms/djangoapps/linkedin/templates/linkedin_email.html
Normal file
25
lms/djangoapps/linkedin/templates/linkedin_email.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% 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>
|
||||
Reference in New Issue
Block a user