fix user.exists returns an object with property exists
This commit is contained in:
@ -427,10 +427,10 @@ profileValidation.directive('uniqueUsername', ['$http', function($http) {
|
|||||||
var config = { params: { username: username } };
|
var config = { params: { username: username } };
|
||||||
$http
|
$http
|
||||||
.get('/api/users/exists', config)
|
.get('/api/users/exists', config)
|
||||||
.success(function (exists) {
|
.success(function (result) {
|
||||||
if (username === scope.storedUsername) {
|
if (username === scope.storedUsername) {
|
||||||
ngModel.$setValidity('unique', true);
|
ngModel.$setValidity('unique', true);
|
||||||
} else if (exists) {
|
} else if (result.exists) {
|
||||||
ngModel.$setValidity('unique', false);
|
ngModel.$setValidity('unique', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -458,8 +458,8 @@ profileValidation.directive('existingUsername',
|
|||||||
var config = { params: { username: username } };
|
var config = { params: { username: username } };
|
||||||
$http
|
$http
|
||||||
.get('/api/users/exists', config)
|
.get('/api/users/exists', config)
|
||||||
.success(function(exists) {
|
.success(function(result) {
|
||||||
ngModel.$setValidity('exists', exists);
|
ngModel.$setValidity('exists', result.exists);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -479,10 +479,10 @@ profileValidation.directive('uniqueEmail', ['$http', function($http) {
|
|||||||
var config = { params: { email: email } };
|
var config = { params: { email: email } };
|
||||||
$http
|
$http
|
||||||
.get('/api/users/exists', config)
|
.get('/api/users/exists', config)
|
||||||
.success(function (exists) {
|
.success(function(result) {
|
||||||
if (email === scope.storedEmail) {
|
if (email === scope.storedEmail) {
|
||||||
ngModel.$setValidity('unique', true);
|
ngModel.$setValidity('unique', true);
|
||||||
} else if (exists.exists) {
|
} else if (result.exists) {
|
||||||
ngModel.$setValidity('unique', false);
|
ngModel.$setValidity('unique', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user