committing what I have for Nathan to continue
This commit is contained in:
@ -186,7 +186,9 @@ exports.checkUniqueUsername = function(req, res) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
exports.checkUniqueEmail = function(req, res) {
|
exports.checkUniqueEmail = function(req, res) {
|
||||||
User.count({'email': req.params.email.toLowerCase()}, function (err, data) {
|
console.log(req.params.email);
|
||||||
|
User.count({'email': decodeURIComponent(req.params.email).toLowerCase()}, function (err, data) {
|
||||||
|
console.log(User.findOne({'email': decodeURIComponent(req.params.email)}));
|
||||||
if (data == 1) {
|
if (data == 1) {
|
||||||
return res.send(true);
|
return res.send(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,6 +60,12 @@ profileValidation.controller('emailSignUpController', ['$scope',
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
profileValidation.controller('emailSignInController', ['$scope',
|
||||||
|
function($scope) {
|
||||||
|
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
profileValidation.directive('uniqueUsername', function($http) {
|
profileValidation.directive('uniqueUsername', function($http) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
@ -79,10 +85,22 @@ profileValidation.directive('uniqueUsername', function($http) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
profileValidation.directive('uniqueEmail', function($http) {
|
||||||
|
return {
|
||||||
profileValidation.controller('emailSignInController', ['$scope',
|
restrict: 'A',
|
||||||
function($scope) {
|
require: 'ngModel',
|
||||||
|
link: function (scope, element, attrs, ngModel) {
|
||||||
}
|
element.bind("keyup", function (event) {
|
||||||
]);
|
ngModel.$setValidity('unique', true);
|
||||||
|
if (element.val()) {
|
||||||
|
console.log(encodeURIComponent(element.val()));
|
||||||
|
$http.get("/api/checkUniqueEmail/" + encodeURIComponent(element.val())).success(function (data) {
|
||||||
|
if (data) {
|
||||||
|
ngModel.$setValidity('unique', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
@ -6,7 +6,11 @@ block content
|
|||||||
input(type='hidden', name='_csrf', value=_csrf)
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-6.col-sm-offset-3
|
.col-sm-6.col-sm-offset-3
|
||||||
input.form-control(type='email', ng-model='email', name='email', id='email', placeholder='email', autofocus, required)
|
input.form-control(type='email', ng-model='email', ng-keypress='', name='email', id='email', placeholder='email', autofocus, required, autocomplete="off")
|
||||||
|
.col-sm-6.col-sm-offset-3(ng-show="signupForm.email.$error.unique && !signupForm.email.$pristine")
|
||||||
|
alert(type='danger')
|
||||||
|
span.ion-close-circled
|
||||||
|
| This email is taken.
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-6.col-sm-offset-3
|
.col-sm-6.col-sm-offset-3
|
||||||
input.form-control(type='text', name='username', ng-keypress='', autocomplete="off", id='username', placeholder='username', ng-model='username', unique-username='', required)
|
input.form-control(type='text', name='username', ng-keypress='', autocomplete="off", id='username', placeholder='username', ng-model='username', unique-username='', required)
|
||||||
|
Reference in New Issue
Block a user