Prevent organizations from attempting an account recovery.

This commit is contained in:
yackob03 2014-01-10 13:30:17 -05:00
parent 1f8a82eefe
commit 223d2ebaf1
3 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -43,7 +43,7 @@
<button class="btn btn-lg btn-primary btn-block" type="submit">Send Recovery Email</button>
</form>
<div class="alert alert-danger" ng-show="invalidEmail">Unable to locate account.</div>
<div class="alert alert-danger" ng-show="invalidRecovery">{{errorMessage}}</div>
<div class="alert alert-success" ng-show="sent">Account recovery email was sent.</div>
</div>

View file

@ -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;
});
};