Commit edeebe7b by lduarte1991

Fixes from @singingwolfboy in PR #3466

parent 26eb16eb
...@@ -61,9 +61,9 @@ class TextAnnotationModule(AnnotatableFields, XModule): ...@@ -61,9 +61,9 @@ class TextAnnotationModule(AnnotatableFields, XModule):
self.instructions = self._extract_instructions(xmltree) self.instructions = self._extract_instructions(xmltree)
self.content = etree.tostring(xmltree, encoding='unicode') self.content = etree.tostring(xmltree, encoding='unicode')
self.user = "" self.user_email = ""
if self.runtime.get_real_user is not None: if self.runtime.get_real_user is not None:
self.user = self.runtime.get_real_user(self.runtime.anonymous_student_id).email self.user_email = self.runtime.get_real_user(self.runtime.anonymous_student_id).email
def _extract_instructions(self, xmltree): def _extract_instructions(self, xmltree):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """ """ Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
...@@ -83,7 +83,7 @@ class TextAnnotationModule(AnnotatableFields, XModule): ...@@ -83,7 +83,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
'instructions_html': self.instructions, 'instructions_html': self.instructions,
'content_html': self.content, 'content_html': self.content,
'annotation_storage': self.annotation_storage_url, 'annotation_storage': self.annotation_storage_url,
'token':retrieve_token(self.user, self.annotation_token_secret), 'token': retrieve_token(self.user_email, self.annotation_token_secret),
} }
return self.system.render_template('textannotation.html', context) return self.system.render_template('textannotation.html', context)
......
...@@ -56,9 +56,9 @@ class VideoAnnotationModule(AnnotatableFields, XModule): ...@@ -56,9 +56,9 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
self.instructions = self._extract_instructions(xmltree) self.instructions = self._extract_instructions(xmltree)
self.content = etree.tostring(xmltree, encoding='unicode') self.content = etree.tostring(xmltree, encoding='unicode')
self.user = "" self.user_email = ""
if self.runtime.get_real_user is not None: if self.runtime.get_real_user is not None:
self.user = self.runtime.get_real_user(self.runtime.anonymous_student_id).email self.user_email = self.runtime.get_real_user(self.runtime.anonymous_student_id).email
def _extract_instructions(self, xmltree): def _extract_instructions(self, xmltree):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """ """ Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
...@@ -93,7 +93,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule): ...@@ -93,7 +93,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
'poster': self.poster_url, 'poster': self.poster_url,
'content_html': self.content, 'content_html': self.content,
'annotation_storage': self.annotation_storage_url, 'annotation_storage': self.annotation_storage_url,
'token': retrieve_token(self.user, self.annotation_token_secret), 'token': retrieve_token(self.user_email, self.annotation_token_secret),
} }
return self.system.render_template('videoannotation.html', context) return self.system.render_template('videoannotation.html', context)
......
Annotator.Plugin.Auth.prototype.haveValidToken = function() { Annotator.Plugin.Auth.prototype.haveValidToken = function() {
var allFields; return (
allFields = this._unsafeToken && this._unsafeToken.d.issuedAt && this._unsafeToken.d.ttl && this._unsafeToken.d.consumerKey; this._unsafeToken &&
if (allFields && this.timeToExpiry() > 0) { this._unsafeToken.d.issuedAt &&
return true; this._unsafeToken.d.ttl &&
} else { this._unsafeToken.d.consumerKey &&
return false; this.timeToExpiry() > 0
} );
}; };
Annotator.Plugin.Auth.prototype.timeToExpiry = function() { Annotator.Plugin.Auth.prototype.timeToExpiry = function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment