mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' into sk-sessions-cluster
This commit is contained in:
commit
f6de4cbb44
6 changed files with 37 additions and 9 deletions
|
@ -25,7 +25,7 @@ else if Settings?.email?.parameters?.sendgridApiKey?
|
||||||
logger.log "using sendgrid for email"
|
logger.log "using sendgrid for email"
|
||||||
nm_client = nodemailer.createTransport(sgTransport({auth:{api_key:Settings?.email?.parameters?.sendgridApiKey}}))
|
nm_client = nodemailer.createTransport(sgTransport({auth:{api_key:Settings?.email?.parameters?.sendgridApiKey}}))
|
||||||
else if Settings?.email?.parameters?
|
else if Settings?.email?.parameters?
|
||||||
smtp = _.pick(Settings?.email?.parameters, "host", "port", "secure", "auth")
|
smtp = _.pick(Settings?.email?.parameters, "host", "port", "secure", "auth", "ignoreTLS")
|
||||||
|
|
||||||
|
|
||||||
logger.log "using smtp for email"
|
logger.log "using smtp for email"
|
||||||
|
|
|
@ -24,7 +24,7 @@ div.full-size(
|
||||||
keybindings="settings.mode",
|
keybindings="settings.mode",
|
||||||
font-size="settings.fontSize",
|
font-size="settings.fontSize",
|
||||||
auto-complete="settings.autoComplete",
|
auto-complete="settings.autoComplete",
|
||||||
spell-check="true",
|
spell-check="!anonymous",
|
||||||
spell-check-language="project.spellCheckLanguage",
|
spell-check-language="project.spellCheckLanguage",
|
||||||
highlights="onlineUserCursorHighlights[editor.open_doc_id]"
|
highlights="onlineUserCursorHighlights[editor.open_doc_id]"
|
||||||
show-print-margin="false",
|
show-print-margin="false",
|
||||||
|
|
|
@ -24,8 +24,10 @@ define [
|
||||||
|
|
||||||
scope[attrs.name].inflight = true
|
scope[attrs.name].inflight = true
|
||||||
|
|
||||||
|
# for asyncForm prevent automatic redirect to /login if
|
||||||
|
# authentication fails, we will handle it ourselves
|
||||||
$http
|
$http
|
||||||
.post(element.attr('action'), formData)
|
.post(element.attr('action'), formData, {disableAutoLoginRedirect: true})
|
||||||
.success (data, status, headers, config) ->
|
.success (data, status, headers, config) ->
|
||||||
scope[attrs.name].inflight = false
|
scope[attrs.name].inflight = false
|
||||||
response.success = true
|
response.success = true
|
||||||
|
|
|
@ -19,11 +19,16 @@ define [
|
||||||
, 200
|
, 200
|
||||||
|
|
||||||
INFINITE_COLLABORATORS = -1
|
INFINITE_COLLABORATORS = -1
|
||||||
$scope.$watch "(project.members.length + project.invites.length)", (noOfMembers) ->
|
|
||||||
allowedNoOfMembers = $scope.project.features.collaborators
|
|
||||||
$scope.canAddCollaborators = noOfMembers < allowedNoOfMembers or allowedNoOfMembers == INFINITE_COLLABORATORS
|
|
||||||
|
|
||||||
window._m = projectMembers
|
$scope.refreshCanAddCollaborators = () ->
|
||||||
|
allowedNoOfMembers = $scope.project.features.collaborators
|
||||||
|
$scope.canAddCollaborators = (
|
||||||
|
($scope.project.members.length + $scope.project.invites.length) < allowedNoOfMembers or allowedNoOfMembers == INFINITE_COLLABORATORS
|
||||||
|
)
|
||||||
|
$scope.refreshCanAddCollaborators()
|
||||||
|
|
||||||
|
$scope.$watch "(project.members.length + project.invites.length)", (_noOfMembers) ->
|
||||||
|
$scope.refreshCanAddCollaborators()
|
||||||
|
|
||||||
$scope.autocompleteContacts = []
|
$scope.autocompleteContacts = []
|
||||||
do loadAutocompleteUsers = () ->
|
do loadAutocompleteUsers = () ->
|
||||||
|
|
|
@ -57,6 +57,7 @@ define [
|
||||||
"Content-Type": 'application/json'
|
"Content-Type": 'application/json'
|
||||||
data:
|
data:
|
||||||
password: $scope.state.password
|
password: $scope.state.password
|
||||||
|
disableAutoLoginRedirect: true # we want to handle errors ourselves
|
||||||
})
|
})
|
||||||
.success () ->
|
.success () ->
|
||||||
$modalInstance.close()
|
$modalInstance.close()
|
||||||
|
|
|
@ -9,6 +9,26 @@ app.config ['$provide', ($provide) ->
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# TODO: add support for an errorHttpInterceptor to catch failing ajax
|
# Interceptor to check auth failures in all $http requests
|
||||||
# requests as described at
|
|
||||||
# http://bahmutov.calepin.co/catch-all-errors-in-angular-app.html
|
# http://bahmutov.calepin.co/catch-all-errors-in-angular-app.html
|
||||||
|
|
||||||
|
app.factory 'unAuthHttpResponseInterceptor', ['$q','$location', ($q, $location) ->
|
||||||
|
responseError: (response) ->
|
||||||
|
# redirect any unauthorised or forbidden responses back to /login
|
||||||
|
#
|
||||||
|
# set disableAutoLoginRedirect:true in the http request config
|
||||||
|
# to disable this behaviour
|
||||||
|
if response.status in [401, 403] and not response.config?.disableAutoLoginRedirect
|
||||||
|
# for /project urls set the ?redir parameter to come back here
|
||||||
|
# otherwise just go to the login page
|
||||||
|
if window.location.pathname.match(/^\/project/)
|
||||||
|
window.location = "/login?redir=#{encodeURI(window.location.pathname)}"
|
||||||
|
else
|
||||||
|
window.location = "/login"
|
||||||
|
# pass the response back to the original requester
|
||||||
|
return $q.reject(response)
|
||||||
|
]
|
||||||
|
|
||||||
|
app.config ['$httpProvider', ($httpProvider) ->
|
||||||
|
$httpProvider.interceptors.push 'unAuthHttpResponseInterceptor'
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in a new issue