Remove debug statements from the server
This commit is contained in:
@ -193,10 +193,8 @@ exports.checkUniqueUsername = function(req, res) {
|
|||||||
exports.checkExistingUsername = function(req, res) {
|
exports.checkExistingUsername = function(req, res) {
|
||||||
User.count({'profile.username': req.params.username.toLowerCase()}, function (err, data) {
|
User.count({'profile.username': req.params.username.toLowerCase()}, function (err, data) {
|
||||||
if (data === 1) {
|
if (data === 1) {
|
||||||
debug('Sending back true');
|
|
||||||
return res.send(true);
|
return res.send(true);
|
||||||
} else {
|
} else {
|
||||||
debug('Sending back false');
|
|
||||||
return res.send(false);
|
return res.send(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -194,18 +194,16 @@ profileValidation.directive('existingUsername', ['$http', function($http) {
|
|||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: function (scope, element, attrs, ngModel) {
|
link: function (scope, element, attrs, ngModel) {
|
||||||
element.bind("keyup", function (event) {
|
element.bind("keyup", function (event) {
|
||||||
console.log(element.val());
|
if (element.val().length > 0) {
|
||||||
if ($('#completed-with').val().length > 0) {
|
|
||||||
ngModel.$setValidity('exists', false);
|
ngModel.$setValidity('exists', false);
|
||||||
} else {
|
} else {
|
||||||
$('#completed-with').removeClass('ng-dirty');
|
$('#completed-with').removeClass('ng-dirty');
|
||||||
ngModel.$setPristine();
|
ngModel.$setPristine();
|
||||||
}
|
}
|
||||||
if ($('#completed-with').val()) {
|
if (element.val()) {
|
||||||
$http
|
$http
|
||||||
.get("/api/checkExistingUsername/" + $('#completed-with').val())
|
.get("/api/checkExistingUsername/" + element.val())
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
console.log('Data received from api call is: ', data);
|
|
||||||
ngModel.$setValidity('exists', data);
|
ngModel.$setValidity('exists', data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user