Merge "Removed user password from portal's profile API"
authorManoop Talasila <talasila@research.att.com>
Tue, 28 May 2019 18:25:02 +0000 (18:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 28 May 2019 18:25:02 +0000 (18:25 +0000)
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserController.java
ecomp-portal-FE-os/client/src/views/header/profile-edit-dialogs/profile-edit.controller.js
ecomp-portal-FE-os/client/src/views/header/profile-edit-dialogs/profile-edit.modal.html

index f4fab56..fc76a0e 100644 (file)
@@ -69,6 +69,8 @@ public class UserController extends EPRestrictedBaseController {
        @Autowired
        private UserService userService;
 
+       private static final String HIDDEN_DEFAULT_PASSWORD = "*****";
+
        /**
         * RESTful service method to get ONAP Logged in User details.
         * 
@@ -83,7 +85,7 @@ public class UserController extends EPRestrictedBaseController {
                try {
                        EPUser user = EPUserUtils.getUserSession(request);
                        ProfileDetail profileDetail = new ProfileDetail(user.getFirstName(), user.getLastName(),
-                                       user.getMiddleInitial(), user.getEmail(), user.getLoginId(),  CipherUtil.decryptPKC(user.getLoginPwd()));
+                                       user.getMiddleInitial(), user.getEmail(), user.getLoginId(),  HIDDEN_DEFAULT_PASSWORD);
                        portalRestResponse = new PortalRestResponse<ProfileDetail>(PortalRestStatusEnum.OK, "success",
                                        profileDetail);
                        EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/loggedinUser", "result =", profileDetail);
@@ -124,7 +126,9 @@ public class UserController extends EPRestrictedBaseController {
                                user.setEmail(profileDetail.getEmail());
                                user.setMiddleInitial(profileDetail.getMiddleName());
                                user.setLoginId(profileDetail.getLoginId());
-                               user.setLoginPwd(CipherUtil.encryptPKC(profileDetail.getLoginPassword()));
+                               if (!HIDDEN_DEFAULT_PASSWORD.equals(profileDetail.getLoginPassword())){
+                                       user.setLoginPwd(CipherUtil.encryptPKC(profileDetail.getLoginPassword()));
+                               }
                                userService.saveUser(user);
                                // Update user info in the session
                                request.getSession().setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME),
index 385697f..597f9b3 100644 (file)
@@ -45,7 +45,6 @@
                this.email ='';
                this.loginId ='';
                this.loginPwd ='';
-               this.confirmLoginPwd=''
                this.isLoading = false;
                let getUser  = () => {
                        this.isLoading = true;
                        loginId :this.loginId,
                        loginPassword :this.loginPwd
                        }
-                       if (this.firstName =='' || this.lastName == '' || this.email == '' || this.loginId =='' || this.loginPwd ==''|| this.confirmLoginPwd ==''){
+                       if (this.firstName =='' || this.lastName == '' || this.email == '' || this.loginId =='' || this.loginPwd ==''){
                                var warningMsg = "Please enter a value for all fields marked with *.";
                                confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
                                return;
-                       } else if (this.loginPwd != this.confirmLoginPwd) {
-                               var warningMsg = "Passwords do not match, please try again.";
-                               confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
-                               return;
                        } else {
                                // check password length complexity.
                                var warningMsg = adminsService.isComplexPassword(this.loginPwd);
index 79c85a1..2ccb03c 100644 (file)
                                                <div class="">*Login Password</div>
                                                <input type="password" ng-model="profileDetail.loginPwd" />
                                        </div>
-                                       <div class="profile-edit-div">
-                                               <div class="">*Confirm Login Password</div>
-                                               <input type="password"
-                                                       ng-model="profileDetail.confirmLoginPwd" />
-                                       </div>
                                </div>
                        </div>
                        <div class="dialog-control">