Explorar o código

Merge pull request #1297 from sharelatex/ja-rate-limit-v2-login

Add rate limit to v2 login end point

GitOrigin-RevId: 81b14387e4a6381f4c0eae17e43af84b2af7fea5
Simon Detheridge %!s(int64=7) %!d(string=hai) anos
pai
achega
d2465f8d6a
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      services/web/public/src/directives/asyncForm.js

+ 8 - 2
services/web/public/src/directives/asyncForm.js

@@ -115,6 +115,12 @@ define(['base', 'libs/passfield'], function(App) {
                   'Session error. Please check you have cookies enabled. If the problem persists, try clearing your cache and cookies.',
                 type: 'error'
               }
+            } else if (status === 429) {
+              response.message = {
+                text:
+                  'Too many attempts. Please wait for a while and try again.',
+                type: 'error'
+              }
             } else {
               response.message = {
                 text:
@@ -146,8 +152,8 @@ define(['base', 'libs/passfield'], function(App) {
     restrict: 'E',
     template: `\
 <div class="alert" ng-class="{
-	'alert-danger': form.response.message.type == 'error',
-	'alert-success': form.response.message.type != 'error'
+  'alert-danger': form.response.message.type == 'error',
+  'alert-success': form.response.message.type != 'error'
 }" ng-show="!!form.response.message" ng-bind-html="form.response.message.text">
 </div>
 <div ng-transclude></div>\