Prevent organizations from attempting an account recovery.
This commit is contained in:
parent
1f8a82eefe
commit
223d2ebaf1
3 changed files with 8 additions and 3 deletions
|
@ -350,6 +350,9 @@ def create_reset_password_email_code(email):
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
raise InvalidEmailAddressException('Email address was not found.');
|
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)
|
code = EmailConfirmation.create(user=user, pw_reset=True)
|
||||||
return code
|
return code
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Send Recovery Email</button>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Send Recovery Email</button>
|
||||||
</form>
|
</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 class="alert alert-success" ng-show="sent">Account recovery email was sent.</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -831,10 +831,12 @@ quayApp.directive('userSetup', function () {
|
||||||
controller: function($scope, $location, $timeout, ApiService, KeyService, UserService) {
|
controller: function($scope, $location, $timeout, ApiService, KeyService, UserService) {
|
||||||
$scope.sendRecovery = function() {
|
$scope.sendRecovery = function() {
|
||||||
ApiService.requestRecoveryEmail($scope.recovery).then(function() {
|
ApiService.requestRecoveryEmail($scope.recovery).then(function() {
|
||||||
$scope.invalidEmail = false;
|
$scope.invalidRecovery = false;
|
||||||
|
$scope.errorMessage = '';
|
||||||
$scope.sent = true;
|
$scope.sent = true;
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
$scope.invalidEmail = true;
|
$scope.invalidRecovery = true;
|
||||||
|
$scope.errorMessage = result.data;
|
||||||
$scope.sent = false;
|
$scope.sent = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue