Skip to content

* Hide password when registering or modifying users #5414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Apollo 2.5.0
* [Security: Prevent unauthorized access to other users' apps in /apps/by-owner endpoint](https://github.com/apolloconfig/apollo/pull/5396)
* [Fix: Bump h2database and snakeyaml version](https://github.com/apolloconfig/apollo/pull/5406)
* [Bugfix: Correct permission target format to appId+env+namespace/cluster](https://github.com/apolloconfig/apollo/pull/5407)
* [Security: Hide password when registering or modifying users](https://github.com/apolloconfig/apollo/pull/5414)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/16?closed=1)
2 changes: 2 additions & 0 deletions apollo-portal/src/main/resources/static/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@
"UserMange.UserName": "User Login Name",
"UserMange.UserDisplayName": "User Display Name",
"UserMange.Pwd": "Password",
"UserMange.ConfirmPwd": "Confirm Password",
"UserMange.PwdNotMatch": "Passwords do not match",
"UserMange.Email": "Email",
"UserMange.Created": "Create user successfully",
"UserMange.CreateFailed": "Failed to create user",
Expand Down
2 changes: 2 additions & 0 deletions apollo-portal/src/main/resources/static/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@
"UserMange.UserName": "用户登录账户",
"UserMange.UserDisplayName": "用户名称",
"UserMange.Pwd": "密码",
"UserMange.ConfirmPwd": "确认密码",
"UserMange.PwdNotMatch": "密码不匹配",
"UserMange.Email": "邮箱",
"UserMange.Created": "创建用户成功",
"UserMange.CreateFailed": "创建用户失败",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
$scope.changeStatus = changeStatus
$scope.searchUsers = searchUsers
$scope.resetSearchUser = resetSearchUser
$scope.validatePwdMatch = validatePwdMatch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.


initPermission();

Expand Down Expand Up @@ -85,6 +86,13 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
searchUsers()
}

function validatePwdMatch() {
$scope.pwdNotMatch = false;
if ($scope.user.password && $scope.user.password != $scope.user.confirmPassword) {
$scope.pwdNotMatch = true;
}
}

$scope.changeUserEnabled = function (user) {
var newUser={}
if (user != null) {
Expand All @@ -104,6 +112,10 @@ function UserController($scope, $window, $translate, toastr, AppUtil, UserServic
}

$scope.createOrUpdateUser = function () {
validatePwdMatch();
if ($scope.pwdNotMatch) {
return;
}
if ($scope.status === '2') {
UserService.createOrUpdateUser(true, $scope.user).then(function (result) {
toastr.success($translate.instant('UserMange.Created'));
Expand Down
16 changes: 14 additions & 2 deletions apollo-portal/src/main/resources/static/user-manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,19 @@
{{'UserMange.Pwd' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="password" ng-model="user.password">
<input type="password" class="form-control" name="password" ng-model="user.password">
<div ng-show="pwdNotMatch" ng-model="pwdNotMatch" style="color:red">
{{'UserMange.PwdNotMatch' | translate }}
</div>
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'UserMange.ConfirmPwd' | translate }}
</label>
<div class="col-sm-5">
<input type="password" class="form-control" name="confirmPassword" ng-model="user.confirmPassword" ng-blur="validatePwdMatch()">
</div>
</div>
<div class="form-group" valdr-form-group>
Expand All @@ -157,7 +169,7 @@
<div class="col-sm-offset-2 col-sm-9">

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