Commit 82007ecf authored by Randall Leeds's avatar Randall Leeds

Simplify plugin resets on persona change

parent b4ddbd64
......@@ -41,15 +41,12 @@ class App
$scope.auth.persona = oldValue
return
if plugins.Auth?
plugins.Auth.token = null
plugins.Auth.updateHeaders()
plugins.Auth?.element.removeData('annotator:headers')
delete plugins.Auth
if plugins.Permissions?
plugins.Permissions.setUser(null)
plugins.Permissions?.setUser(null)
# XXX: Temporary workaround until Annotator v2.0 or v1.2.10
plugins.Permissions.options.permissions =
plugins.Permissions?.options.permissions =
read: []
update: []
delete: []
......@@ -57,8 +54,7 @@ class App
if newValue?
acct = "acct:#{newValue.username}@#{newValue.provider}"
annotator.addPlugin 'Auth',
tokenUrl: "/api/token?persona=#{acct}"
annotator.addPlugin 'Auth', tokenUrl: "/api/token?persona=#{acct}"
plugins.Auth.withToken (token) =>
plugins.Permissions._setAuthFromToken token
......
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