Skip to content

Commit cf8889b

Browse files
committed
* Hide password when registering or modifying users
1 parent cf0ad6d commit cf8889b

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ Apollo 2.5.0
1616
* [Security: Prevent unauthorized access to other users' apps in /apps/by-owner endpoint](https://github.com/apolloconfig/apollo/pull/5396)
1717
* [Fix: Bump h2database and snakeyaml version](https://github.com/apolloconfig/apollo/pull/5406)
1818
* [Bugfix: Correct permission target format to appId+env+namespace/cluster](https://github.com/apolloconfig/apollo/pull/5407)
19+
* [Security: Hide password when registering or modifying users](https://github.com/apolloconfig/apollo/pull/5414)
1920
------------------
2021
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/16?closed=1)

apollo-portal/src/main/resources/static/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@
622622
"UserMange.UserName": "User Login Name",
623623
"UserMange.UserDisplayName": "User Display Name",
624624
"UserMange.Pwd": "Password",
625+
"UserMange.ConfirmPwd": "Confirm Password",
626+
"UserMange.PwdNotMatch": "Passwords do not match",
625627
"UserMange.Email": "Email",
626628
"UserMange.Created": "Create user successfully",
627629
"UserMange.CreateFailed": "Failed to create user",

apollo-portal/src/main/resources/static/i18n/zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@
622622
"UserMange.UserName": "用户登录账户",
623623
"UserMange.UserDisplayName": "用户名称",
624624
"UserMange.Pwd": "密码",
625+
"UserMange.ConfirmPwd": "确认密码",
626+
"UserMange.PwdNotMatch": "密码不匹配",
625627
"UserMange.Email": "邮箱",
626628
"UserMange.Created": "创建用户成功",
627629
"UserMange.CreateFailed": "创建用户失败",

apollo-portal/src/main/resources/static/scripts/controller/UserController.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
2828
$scope.changeStatus = changeStatus
2929
$scope.searchUsers = searchUsers
3030
$scope.resetSearchUser = resetSearchUser
31+
$scope.validatePwdMatch = validatePwdMatch
3132

3233
initPermission();
3334

@@ -85,6 +86,13 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
8586
searchUsers()
8687
}
8788

89+
function validatePwdMatch() {
90+
$scope.pwdNotMatch = false;
91+
if ($scope.user.password && $scope.user.password != $scope.user.confirmPassword) {
92+
$scope.pwdNotMatch = true;
93+
}
94+
}
95+
8896
$scope.changeUserEnabled = function (user) {
8997
var newUser={}
9098
if (user != null) {
@@ -104,6 +112,10 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
104112
}
105113

106114
$scope.createOrUpdateUser = function () {
115+
validatePwdMatch();
116+
if ($scope.pwdNotMatch) {
117+
return;
118+
}
107119
if ($scope.status === '2') {
108120
UserService.createOrUpdateUser(true, $scope.user).then(function (result) {
109121
toastr.success($translate.instant('UserMange.Created'));

apollo-portal/src/main/resources/static/user-manage.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,19 @@
131131
{{'UserMange.Pwd' | translate }}
132132
</label>
133133
<div class="col-sm-5">
134-
<input type="text" class="form-control" name="password" ng-model="user.password">
134+
<input type="password" class="form-control" name="password" ng-model="user.password">
135+
<div ng-show="pwdNotMatch" ng-model="pwdNotMatch" style="color:red">
136+
{{'UserMange.PwdNotMatch' | translate }}
137+
</div>
138+
</div>
139+
</div>
140+
<div class="form-group" valdr-form-group>
141+
<label class="col-sm-2 control-label">
142+
<apollorequiredfield></apollorequiredfield>
143+
{{'UserMange.ConfirmPwd' | translate }}
144+
</label>
145+
<div class="col-sm-5">
146+
<input type="password" class="form-control" name="confirmPassword" ng-model="user.confirmPassword" ng-blur="validatePwdMatch()">
135147
</div>
136148
</div>
137149
<div class="form-group" valdr-form-group>
@@ -157,7 +169,7 @@
157169
<div class="col-sm-offset-2 col-sm-9">
158170

159171
<button type="submit" class="btn btn-primary"
160-
ng-disabled="appForm.$invalid || submitBtnDisabled">{{status==='3' ? ('UserMange.Save' | translate) : ('Common.Submit' | translate) }}
172+
ng-disabled="appForm.$invalid || submitBtnDisabled || pwdNotMatch">{{status==='3' ? ('UserMange.Save' | translate) : ('Common.Submit' | translate) }}
161173
</button>
162174
<button type="button" ng-click="changeStatus('1')" class="btn">{{status==='3' ? ('UserMange.Cancel' | translate) : ('UserMange.Back' | translate) }}</button>
163175
</div>

0 commit comments

Comments
 (0)