diff --git a/data/model.py b/data/model.py index 4087e5284..a755fe8d9 100644 --- a/data/model.py +++ b/data/model.py @@ -350,6 +350,9 @@ def create_reset_password_email_code(email): except User.DoesNotExist: raise InvalidEmailAddressException('Email address was not found.'); + if user.organization: + raise InvalidEmailAddressException('Organizations can not have passwords.') + code = EmailConfirmation.create(user=user, pw_reset=True) return code diff --git a/static/directives/user-setup.html b/static/directives/user-setup.html index 1e830ec1b..34f2a0b78 100644 --- a/static/directives/user-setup.html +++ b/static/directives/user-setup.html @@ -43,7 +43,7 @@ -
Unable to locate account.
+
{{errorMessage}}
Account recovery email was sent.
diff --git a/static/js/app.js b/static/js/app.js index 30cb7a6b3..08aeac94b 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -831,10 +831,12 @@ quayApp.directive('userSetup', function () { controller: function($scope, $location, $timeout, ApiService, KeyService, UserService) { $scope.sendRecovery = function() { ApiService.requestRecoveryEmail($scope.recovery).then(function() { - $scope.invalidEmail = false; + $scope.invalidRecovery = false; + $scope.errorMessage = ''; $scope.sent = true; }, function(result) { - $scope.invalidEmail = true; + $scope.invalidRecovery = true; + $scope.errorMessage = result.data; $scope.sent = false; }); };