diff --git a/app/controllers/users/users.authentication.server.controller.js b/app/controllers/users/users.authentication.server.controller.js index 1d616afa..46213490 100755 --- a/app/controllers/users/users.authentication.server.controller.js +++ b/app/controllers/users/users.authentication.server.controller.js @@ -122,12 +122,6 @@ exports.signup = function(req, res) { // Add missing user fields user.provider = 'local'; - if(req.body.password.length < 4){ - return res.status(400).send({ - message: 'Password must be at least 4 characters long' - }); - } - // Then save the temporary user nev.createTempUser(user, function (err, existingPersistentUser, newTempUser) { if (err) { @@ -167,13 +161,7 @@ exports.signup = function(req, res) { * Signin after passport authentication */ exports.signin = function(req, res, next) { - console.log(req.body); - if(req.body.password.length < 4){ - return res.status(400).send({ - message: 'Password must be at least 4 characters long' - }); - } - + passport.authenticate('local', function(err, user, info) { if (err || !user) { res.status(400).send(info); diff --git a/app/models/user.server.model.js b/app/models/user.server.model.js index 8e2f0d0d..f8b16236 100755 --- a/app/models/user.server.model.js +++ b/app/models/user.server.model.js @@ -37,13 +37,6 @@ var validateLocalStrategyProperty = function(property) { return ((this.provider !== 'local' && !this.updated) || propHasLength); }; -/** - * A Validation function for local strategy password - */ -var validateLocalStrategyPassword = function(password) { - return (this.provider !== 'local' || (password && password.length > 6)); -}; - /** * A Validation function for username */ diff --git a/public/form_modules/forms/base/css/form.css b/public/form_modules/forms/base/css/form.css index c149b54c..2a9665bd 100644 --- a/public/form_modules/forms/base/css/form.css +++ b/public/form_modules/forms/base/css/form.css @@ -438,11 +438,11 @@ section.public-form .btn { } /*CREATE-NEW FORM MODAL*/ -.form-item.create-new.new-form { +.form-item.new-form { background-color: rgb(300,131,131); z-index: 11; } -.form-item.create-new.new-form:hover { +.form-item.new-form:hover { background-color: rgb(300,100,100); } .form-item.new-form input[type='text'] { diff --git a/public/modules/forms/admin/views/list-forms.client.view.html b/public/modules/forms/admin/views/list-forms.client.view.html index 25013d05..cea95d84 100644 --- a/public/modules/forms/admin/views/list-forms.client.view.html +++ b/public/modules/forms/admin/views/list-forms.client.view.html @@ -28,7 +28,7 @@

-
+

diff --git a/public/modules/forms/base/css/form.css b/public/modules/forms/base/css/form.css index 7e467bea..03537d98 100644 --- a/public/modules/forms/base/css/form.css +++ b/public/modules/forms/base/css/form.css @@ -310,12 +310,12 @@ section.public-form field-directive .btn[disabled]{ } /*CREATE-NEW FORM MODAL*/ -.form-item.create-new.new-form { +.form-item.new-form { background-color: #832383; background-color: rgb(300,131,131); z-index: 11; } -.form-item.create-new.new-form:hover { +.form-item.new-form:hover { background-color: #3079b5; } .form-item.new-form input[type='text'] { @@ -398,19 +398,23 @@ h3.forms-list-title { font-size: 1.3em; } -.form-item.create-new .title-row{ +.form-item.create-new .title-row { padding: 0; } .form-item.create-new .title-row h4 { font-size: 7em; } -.form-item .details-row{ - margin-top: 3.2em; +.form-item.create-new.new-button .details-row { + padding-top: 20%; } - .form-item .details-row small { + .form-item .details-row small { font-size: 0.6em; } - .form-item.create-new .details-row small { + .form-item.create-new .details-row small { font-size: 0.95em; } + + .form-item.create-new input { + max-width: 100% + } diff --git a/public/modules/users/controllers/authentication.client.controller.js b/public/modules/users/controllers/authentication.client.controller.js index d248d508..1a9db40d 100755 --- a/public/modules/users/controllers/authentication.client.controller.js +++ b/public/modules/users/controllers/authentication.client.controller.js @@ -7,29 +7,30 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$loca $scope = $rootScope; $scope.credentials = {}; $scope.error = ''; - $scope.forms = []; + $scope.forms = {}; $scope.signin = function() { - console.log($scope.forms.signinForm); - User.login($scope.credentials).then( - function(response) { - Auth.login(response); - $scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User); + if(!$scope.forms.signinForm.$invalid){ + User.login($scope.credentials).then( + function(response) { + Auth.login(response); + $scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User); - if($state.previous.name !== 'home' && $state.previous.name !== 'verify' && $state.previous.name !== '') { - $state.go($state.previous.name); - } else { - $state.go('listForms'); + if($state.previous.name !== 'home' && $state.previous.name !== 'verify' && $state.previous.name !== '') { + $state.go($state.previous.name); + } else { + $state.go('listForms'); + } + }, + function(error) { + $rootScope.user = Auth.ensureHasCurrentUser(User); + $scope.user = $rootScope.user; + + $scope.error = error; + console.error('loginError: '+error); } - }, - function(error) { - $rootScope.user = Auth.ensureHasCurrentUser(User); - $scope.user = $rootScope.user; - - $scope.error = error; - console.error('loginError: '+error); - } - ); + ); + } }; $scope.signup = function() { @@ -38,20 +39,22 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$loca return; } - User.signup($scope.credentials).then( - function(response) { - $state.go('signup-success'); - }, - function(error) { - console.error(error); - if(error) { - $scope.error = error; - console.error(error); - } else { - console.error('No response received'); - } - } - ); + if(!$scope.forms.signupForm.$invalid){ + User.signup($scope.credentials).then( + function(response) { + $state.go('signup-success'); + }, + function(error) { + console.error(error); + if(error) { + $scope.error = error; + console.error(error); + } else { + console.error('No response received'); + } + } + ); + } }; } diff --git a/public/modules/users/controllers/password.client.controller.js b/public/modules/users/controllers/password.client.controller.js index 52dfc65c..2744bdc3 100755 --- a/public/modules/users/controllers/password.client.controller.js +++ b/public/modules/users/controllers/password.client.controller.js @@ -5,6 +5,7 @@ angular.module('users').controller('PasswordController', ['$scope', '$stateParam $translate.use($window.locale); $scope.error = ''; + $scope.forms = {}; // Submit forgotten password account id $scope.askForPasswordReset = function() { @@ -24,24 +25,25 @@ angular.module('users').controller('PasswordController', ['$scope', '$stateParam // Change user password $scope.resetUserPassword = function() { - $scope.success = $scope.error = null; - User.resetPassword($scope.passwordDetails, $stateParams.token).then( - function(response){ - console.log(response.message); - // If successful show success message and clear form - $scope.success = response.message; - $scope.error = null; - $scope.passwordDetails = null; + if(!$scope.forms.resetPasswordForm.$invalid){ + $scope.success = $scope.error = null; + User.resetPassword($scope.passwordDetails, $stateParams.token).then( + function(response){ + // If successful show success message and clear form + $scope.success = response.message; + $scope.error = null; + $scope.passwordDetails = null; - // And redirect to the index page - $state.go('reset-success'); - }, - function(error){ - $scope.error = error.message || error; - $scope.success = null; - $scope.passwordDetails = null; - } - ); + // And redirect to the index page + $state.go('reset-success'); + }, + function(error){ + $scope.error = error.message || error; + $scope.success = null; + $scope.passwordDetails = null; + } + ); + } }; } ]); diff --git a/public/modules/users/views/authentication/signup.client.view.html b/public/modules/users/views/authentication/signup.client.view.html index 4b2f96e7..7b49bcf9 100644 --- a/public/modules/users/views/authentication/signup.client.view.html +++ b/public/modules/users/views/authentication/signup.client.view.html @@ -4,7 +4,7 @@
-