fix: display auth window when the password need be checked before shu…#61
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#61
64db2f1 to
6a1b685
Compare
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#61
…tdown or reboot when the password need be checked before shutdown or reboot, if the lock is showing, need show auth window. Log: display auth window when the password need be checked before shutdown or reboot Pms: BUG-353333 BUG-338545
6a1b685 to
609bc79
Compare
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#61
deepin pr auto review这段代码变更存在严重的逻辑错误,会导致功能异常。以下是对该变更的详细审查意见: 1. 代码逻辑审查问题描述: 这是一个逻辑反转的严重错误,完全改变了原有的业务逻辑。 具体分析:
结论:这会导致除了特定的关机/重启+验证密码场景外,其他原本应该进入锁屏界面的场景全部失效。 2. 语法与代码质量
3. 改进建议如果目的是在关机或重启前增加一个密码验证( 假设确实需要修改这里的逻辑(例如:只有验证过密码的关机/重启才允许进入锁屏,否则直接关机),建议如下: 修正方案 A(如果意图是逻辑反转): bool isStandardPowerAction = (m_powerAction == SessionBaseModel::RequireShutdown ||
m_powerAction == SessionBaseModel::RequireRestart);
// 只有是标准电源操作 且 通过了密码检查,才进入锁屏
if ( ... && isStandardPowerAction && m_model->gsCheckpwd()) {
// ...
}修正方案 B(如果意图是原逻辑保持不变,只是想加密码检查): // 保持原有的排除逻辑
bool isStandardPowerAction = (m_powerAction == SessionBaseModel::RequireShutdown ||
m_powerAction == SessionBaseModel::RequireRestart);
// 如果是标准电源操作,且未通过密码检查,则不进入锁屏(直接执行后续操作)
if (isStandardPowerAction && !m_model->gsCheckpwd()) {
// 不进入锁屏,直接返回或执行关机
return;
}
// 原有逻辑:非上述特定模式,执行锁屏
if (m_model->currentModeState() != SessionBaseModel::ModeStatus::PowerMode
&& m_powerAction != SessionBaseModel::RequireUpdateShutdown
&& m_powerAction != SessionBaseModel::RequireUpdateRestart
&& m_powerAction != SessionBaseModel::RequireShutdown // 原有逻辑
&& m_powerAction != SessionBaseModel::RequireRestart) { // 原有逻辑
FullScreenBackground::setContent(LockContent::instance());
m_model->setCurrentContentType(SessionBaseModel::LockContent);
}4. 安全性
总结强烈建议拒绝此代码变更。该变更破坏了原有的业务逻辑,且未提供清晰的注释说明为何进行如此巨大的逻辑反转。请开发者重新确认需求,并提供符合预期的逻辑实现。 |
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#61
…tdown or reboot
when the password need be checked before shutdown or reboot, if the lock is showing, need show auth window.
Log: display auth window when the password need be checked before shutdown or reboot
Pms: BUG-353333 BUG-338545