mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Anon read-token: add an Authorization header to $http
This commit is contained in:
parent
a66cb15f48
commit
34d4d1360f
4 changed files with 6 additions and 1 deletions
|
@ -303,6 +303,7 @@ module.exports = ProjectController =
|
|||
privilegeLevel: privilegeLevel
|
||||
chatUrl: Settings.apis.chat.url
|
||||
anonymous: anonymous
|
||||
anonToken: req._anonToken
|
||||
languages: Settings.languages
|
||||
themes: THEME_LIST
|
||||
maxDocLength: Settings.max_doc_length
|
||||
|
|
|
@ -61,6 +61,7 @@ module.exports = TokenAccessController =
|
|||
"error adding user to project with readAndWrite token"
|
||||
return next(err)
|
||||
req.params.Project_id = project._id.toString()
|
||||
req._anonToken = token
|
||||
return ProjectController.loadEditor(req, res, next)
|
||||
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ block requirejs
|
|||
window.user = data.user;
|
||||
window.csrfToken = "!{csrfToken}";
|
||||
window.anonymous = #{anonymous};
|
||||
window.anonToken = "#{anonToken}";
|
||||
window.maxDocLength = #{maxDocLength};
|
||||
window.trackChangesState = data.trackChangesState;
|
||||
window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding};
|
||||
|
|
|
@ -17,7 +17,9 @@ define [
|
|||
"ErrorCatcher"
|
||||
"localStorage"
|
||||
"ngTagsInput"
|
||||
]).config ($qProvider, sixpackProvider)->
|
||||
]).config ($qProvider, sixpackProvider, $httpProvider)->
|
||||
if window.anonToken
|
||||
$httpProvider.defaults.headers.common['Authorization'] = window.anonToken
|
||||
$qProvider.errorOnUnhandledRejections(false)
|
||||
sixpackProvider.setOptions({
|
||||
debug: false
|
||||
|
|
Loading…
Reference in a new issue