From 60fd3816a74cabbad309d1320fb21121001e0b8d Mon Sep 17 00:00:00 2001 From: liuxinhao Date: Wed, 19 Jan 2022 15:22:48 +0800 Subject: [PATCH] fix(create user): the user was created successfully, but the property setting failed. The user will not be deleted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建用户成功,设置属性失败不删除用户,弹窗警告用户 Closes #47439 Signed-off-by: liuxinhao --- src/hard-worker.cpp | 6 +- .../advance-settings.cpp | 2 +- .../create-user-page/create-user-page.cpp | 10 ++- translations/kiran-cpanel-account.zh_CN.ts | 85 ++++++++++--------- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/hard-worker.cpp b/src/hard-worker.cpp index 89ac041..3ab232c 100644 --- a/src/hard-worker.cpp +++ b/src/hard-worker.cpp @@ -110,7 +110,10 @@ void HardWorker::doCreateUser(QString userName, KLOG_INFO() << QString("create user(%1) is done").arg(userName); emit sigCreateUserDnoe(userObjPath, ""); return; + failed: + //NOTE:创建用户成功,设置用户属性失败时,不再删除用户 +#if 0 if (!userObjPath.isEmpty()) { KSDAccountsUserProxy userInterface(ACCOUNTS_DBUS_NAME, @@ -125,13 +128,14 @@ failed: KLOG_WARNING() << "create user failed,delete user:" << reply.error(); } } +#endif QString errMsg = errMsgPrefix; if (!errMsgDetail.isEmpty()) { errMsg.append(","); errMsg.append(errMsgDetail); } - emit sigCreateUserDnoe("", errMsg); + emit sigCreateUserDnoe(userObjPath, errMsg); } void HardWorker::doUpdatePasswd(QString objPath, diff --git a/src/pages/advance-settings-page/advance-settings.cpp b/src/pages/advance-settings-page/advance-settings.cpp index 3fd7900..244cf00 100644 --- a/src/pages/advance-settings-page/advance-settings.cpp +++ b/src/pages/advance-settings-page/advance-settings.cpp @@ -58,7 +58,7 @@ void AdvanceSettings::setInfo(QString userName, AdvanceSettingsInfo &info) } else { - ui->edit_loginShell->clear(); + ui->edit_loginShell->setText(DEFAULT_SHELL); } ///缓存账用户信息,当特殊用户Home目录设置关闭时,重新生成Home目录路径 diff --git a/src/pages/create-user-page/create-user-page.cpp b/src/pages/create-user-page/create-user-page.cpp index 69092a6..7f3956e 100644 --- a/src/pages/create-user-page/create-user-page.cpp +++ b/src/pages/create-user-page/create-user-page.cpp @@ -241,11 +241,15 @@ void CreateUserPage::handlerCreateNewUserIsDone(QString userPath, { emit sigIsBusyChanged(false); ui->btn_confirm->setBusy(false); - if (!errMsg.isEmpty()) + if (!errMsg.isEmpty() && userPath.isEmpty()) { - KiranMessageBox::message(nullptr, tr("Error"), - errMsg, KiranMessageBox::Yes | KiranMessageBox::No); + KiranMessageBox::message(nullptr, tr("Error"),errMsg, KiranMessageBox::Ok); } + else if(!errMsg.isEmpty() && !userPath.isEmpty()) + { + KiranMessageBox::message(nullptr,tr("Warning"),errMsg,KiranMessageBox::Ok); + } + if (!userPath.isEmpty()) { emit sigRequestSetCurrentUser(userPath); diff --git a/translations/kiran-cpanel-account.zh_CN.ts b/translations/kiran-cpanel-account.zh_CN.ts index 9a48aef..6b430c9 100644 --- a/translations/kiran-cpanel-account.zh_CN.ts +++ b/translations/kiran-cpanel-account.zh_CN.ts @@ -76,8 +76,8 @@ 取消 - - + + Automatically generated by system 由系统自动生成 @@ -89,17 +89,17 @@ 指定用户目录 - + Please enter the correct path 请输入正确的路径 - + Please enter specify user Id 请输入用户ID - + Please enter the correct home directory 请输入正确的用户目录 @@ -212,12 +212,12 @@ 账户类型 - + standard 普通用户 - + administrator 管理员 @@ -298,51 +298,56 @@ 请输入用户名 - + Please enter user name first 请输入用户名 - + Please enter your user name 请输入用户名 - + user name cannot be a pure number 用户名不能全为数字 - + user name already exists 用户名已存在 - + Please enter your password 请输入密码 - + Please enter the password again 请再次输入密码 - + The password you enter must be the same as the former one 两次密码不相同,请核对后,再次输入 - - + + Error 错误 - + Password encryption failed 密码加密失败 + + + Warning + 警告 + FaceEnrollDialog @@ -520,17 +525,17 @@ 设置用户属性失败 - + update password failed 更新密码失败 - + icon file 头像 - + userName type 用户名 @@ -539,12 +544,12 @@ 账户类型 - + locked 启用状态 - + Failed to update user properties,%1 更新用户属性失败,%1 @@ -553,7 +558,7 @@ 更新用户属性失败(%1) - + Failed to delete user,%1 删除用户失败,%1 @@ -837,12 +842,12 @@ 取消 - + standard 普通用户 - + administrator 管理员 @@ -851,65 +856,65 @@ 账户信息更新成功 - + Password updated successfully 密码更新成功 - + The directory and files under the user's home directory are deleted with the user.Are you sure you want to delete the user(%1)? 用户目录下的目录和文件会随用户一起删除,确定要删除%1用户吗? - + Warning 警告 - + Please enter the new user password 请输入新密码 - + Please enter the password again 请再次输入密码 - + The password you enter must be the same as the former one 两次密码不相同,请核对后,再次输入 - + Please enter the current user password 请输入当前密码 - + The current password is incorrect 当前密码错误,请再次输入 - + The new password cannot be the same as the current password 新密码不能和旧密码相同,请重新输入 - - - - + + + + Error 错误 - + Password encryption failed 密码加密失败 - + user information updated successfully 用户信息更新成功 -- 2.27.0