From ee457b68ac6f1c048099eda4a0973c4e0a0c2172 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Thu, 15 Jan 2015 15:58:54 +0000
Subject: [PATCH] SSDM-1419: PAPER - UI to create Users - Polishments

SVN: 33263
---
 .../UserManager/modal/CreateUserController.js |  2 +-
 .../modal/ResetPasswordController.js          | 25 +++++++++++--------
 .../UserManager/modal/ResetPasswordModel.js   |  1 +
 .../UserManager/modal/ResetPasswordView.js    |  9 ++++++-
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/CreateUserController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/CreateUserController.js
index c493b4a9929..369a0b5117b 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/CreateUserController.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/CreateUserController.js
@@ -54,7 +54,7 @@ function CreateUserController() {
 								}
 							});
 				} else {
-					Util.showError("Passwords are not equal.", function() {});
+					Util.showError("Passwords are not equal.");
 				}
 			}
 		
diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordController.js
index 1fb21c58d5a..8aaa6bb9b3f 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordController.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordController.js
@@ -20,16 +20,21 @@ function ResetPasswordController(userId) {
 	
 	this.resetPassword = function() {
 		var _this = this;
-		mainController.serverFacade.registerUserPassword(
-				_this._resetPasswordModel.userId,
-				_this._resetPasswordModel.password,
-				function(isRegistered) {
-					if(isRegistered) {
-						Util.showSuccess("Password has been reset on the file authentication service.");
-					} else {
-						Util.showError("Password can't be reset.");
-					}
-				});
+		
+		if(_this._createUserModel.password === _this._createUserModel.passwordRepeat) {
+			mainController.serverFacade.registerUserPassword(
+					_this._resetPasswordModel.userId,
+					_this._resetPasswordModel.password,
+					function(isRegistered) {
+						if(isRegistered) {
+							Util.showSuccess("Password has been reset on the file authentication service.");
+						} else {
+							Util.showError("Password can't be reset.");
+						}
+					});
+		} else {
+			Util.showError("Passwords are not equal.");
+		}
 	}
 	
 	this.init = function() {
diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordModel.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordModel.js
index 64cda7fdf31..8e26f49a055 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordModel.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordModel.js
@@ -17,4 +17,5 @@
 function ResetPasswordModel(userId) {
 	this.userId = userId;
 	this.password = null;
+	this.passwordRepeat = null;
 }
\ No newline at end of file
diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordView.js
index 23a0dfb849c..9ba118b3748 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordView.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/UserManager/modal/ResetPasswordView.js
@@ -49,13 +49,20 @@ function ResetPasswordView(resetPasswordController, resetPasswordModel) {
 		//
 		// Password
 		//
-		var $passField = FormUtil._getInputField('text', null, 'Password', null, true);
+		var $passField = FormUtil._getInputField('password', null, 'Password', null, true);
 		$passField.change(function(event) {
 			_this._resetPasswordModel.password = $(this).val();
 		});
 		var $passwordGroup = FormUtil.getFieldForComponentWithLabel($passField, "Password", null);
 		$window.append($passwordGroup);
 		
+		var $passFieldRepeat = FormUtil._getInputField('password', null, 'Repeat the same password', null, true);
+		$passFieldRepeat.change(function(event) {
+			_this._resetPasswordModel.passwordRepeat = $(this).val();
+		});
+		var $passwordGroupRepeat = FormUtil.getFieldForComponentWithLabel($passFieldRepeat, "Password Repeat", null);
+		$window.append($passwordGroupRepeat);
+		
 		//
 		// Buttons
 		//
-- 
GitLab