Просмотр исходного кода

Catch invalid email address and show specific error message

Alasdair Smith 9 лет назад
Родитель
Сommit
320466a4f7

+ 2 - 0
services/web/app/views/project/editor/share.pug

@@ -147,6 +147,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
 						| #{translate("cannot_invite_non_user")}
 					span(ng-switch-when="cannot_invite_self")
 						| #{translate("cannot_invite_self")}
+					span(ng-switch-when="invalid_email")
+						| #{translate("invalid_email")}
 					span(ng-switch-default)
 						| #{translate("generic_something_went_wrong")}
 		button.btn.btn-default(

+ 5 - 2
services/web/public/coffee/ide/share/controllers/ShareProjectModalController.coffee

@@ -127,10 +127,13 @@ define [
 								# with new collaborator information.
 								addNextMember()
 							, 0
-						.catch () ->
+						.catch (err) ->
 							$scope.state.inflight = false
 							$scope.state.error = true
-							$scope.state.errorReason = null
+							if (err.status? and err.status == 400)
+								$scope.state.errorReason = 'invalid_email'
+							else
+								$scope.state.errorReason = null
 
 			$timeout addMembers, 50 # Give email list a chance to update