mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #317 from sharelatex/ho-nice-recaptcha-message
improved recaptcha error message
This commit is contained in:
commit
ba1e45d12c
4 changed files with 11 additions and 5 deletions
|
@ -16,6 +16,8 @@ module.exports = CaptchaMiddleware =
|
|||
return next(error) if error?
|
||||
if !body?.success
|
||||
logger.warn {statusCode: response.statusCode, body: body}, 'failed recaptcha siteverify request'
|
||||
return res.sendStatus 400
|
||||
return res.status(400).send({errorReason:"cannot_verify_user_not_robot", message:
|
||||
{text:"Sorry, we could not verify that you are not a robot. Please check that Google reCAPTCHA is not being blocked by an ad blocker or firewall."}
|
||||
})
|
||||
else
|
||||
return next()
|
||||
|
|
|
@ -65,7 +65,7 @@ module.exports = CollaboratorsInviteController =
|
|||
email = EmailHelper.parseEmail(email)
|
||||
if !email? or email == ""
|
||||
logger.log {projectId, email, sendingUserId}, "invalid email address"
|
||||
return res.sendStatus(400)
|
||||
return res.status(400).send({errorReason:"invalid_email"})
|
||||
CollaboratorsInviteController._checkRateLimit sendingUserId, (error, underRateLimit) ->
|
||||
return next(error) if error?
|
||||
if !underRateLimit
|
||||
|
|
|
@ -185,6 +185,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
|
|||
span(ng-switch="state.errorReason")
|
||||
span(ng-switch-when="cannot_invite_non_user")
|
||||
| #{translate("cannot_invite_non_user")}
|
||||
span(ng-switch-when="cannot_verify_user_not_robot")
|
||||
| #{translate("cannot_verify_user_not_robot")}
|
||||
span(ng-switch-when="cannot_invite_self")
|
||||
| #{translate("cannot_invite_self")}
|
||||
span(ng-switch-when="invalid_email")
|
||||
|
|
|
@ -127,11 +127,13 @@ define [
|
|||
# with new collaborator information.
|
||||
addNextMember()
|
||||
, 0
|
||||
.catch (err) ->
|
||||
.catch (httpResponse) ->
|
||||
{data, status, headers, config } = httpResponse
|
||||
$scope.state.inflight = false
|
||||
$scope.state.error = true
|
||||
if err.status? and err.status == 400
|
||||
$scope.state.errorReason = 'invalid_email'
|
||||
|
||||
if data?.errorReason?
|
||||
$scope.state.errorReason = data?.errorReason
|
||||
else
|
||||
$scope.state.errorReason = null
|
||||
|
||||
|
|
Loading…
Reference in a new issue