-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3454 from learningequality/0.13.x
0.13.x to central-develop
- Loading branch information
Showing
11 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"channel_name": "KA Lite", | ||
"head_line": "A free world-class education for anyone anywhere.", | ||
"tag_line": "KA Lite is a lightweight web server for viewing and interacting with core Khan Academy content (videos and exercises) without needing an Internet connection.", | ||
"tag_line": "KA Lite is a light-weight web server for viewing and interacting with core Khan Academy content (videos and exercises) without needing an Internet connection.", | ||
"channel_license": "CC-BY-NC-SA", | ||
"footer_text": "Videos © 2015 Khan Academy (Creative Commons) // Exercises © 2015 Khan Academy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import requests | ||
from kalite.version import * | ||
|
||
# Modify Request's default user agent to include the KA Lite version number | ||
# (this is done in this file because putting it in __init__.py causes circular imports, | ||
# and putting it in urls.py doesn't get loaded by management commands) | ||
base_headers = requests.defaults.defaults["base_headers"] | ||
base_headers["User-Agent"] = ("ka-lite/%s " % VERSION) + base_headers["User-Agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
from django.conf import settings | ||
from django.contrib import messages | ||
from django.contrib.messages.api import get_messages | ||
from django.core.mail import send_mail | ||
from django.core.urlresolvers import reverse | ||
from django.db import models as db_models | ||
from django.http import HttpResponse | ||
|
@@ -53,8 +54,19 @@ def register_device(request): | |
# Validate the loaded data | ||
if not isinstance(client_device, Device): | ||
return JsonResponseMessageError("Client device must be an instance of the 'Device' model.", code=EC.CLIENT_DEVICE_NOT_DEVICE) | ||
if not client_device.verify(): | ||
return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key.", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE) | ||
|
||
try: | ||
if not client_device.verify(): | ||
# We've been getting this verification error a lot, even when we shouldn't. Send more details to us by email so we can diagnose. | ||
msg = "\n\n".join([request.body, client_device._hashable_representation(), str(client_device.validate()), client_device.signed_by_id, client_device.id, str(request)]) | ||
send_mail("Client device did not verify", msg, "[email protected]", ["[email protected]"]) | ||
return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key!", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE) | ||
except Exception as e: | ||
# Can't properly namespace to a particular Exception here, since the only reason we would be getting here is | ||
# that what should be proper exception namespacing in code being called isn't correctly catching this exception | ||
msg = "\n\n".join([request.body, client_device._hashable_representation(), "Exception: %s" % e, str(type(e)), client_device.signed_by_id, client_device.id, str(request)]) | ||
send_mail("Exception while verifying client device", msg, "[email protected]", ["[email protected]"]) | ||
return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key!", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE) | ||
|
||
try: | ||
zone = register_self_registered_device(client_device, models, data) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters