Repository navigation
fix: login fails after retrying with the correct password #1639
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,21 @@ void GreeterProxy::setLock(bool isLocked) | |
| setShowShutdownView(false); | ||
| } | ||
|
|
||
| void GreeterProxy::beginAuthentication(const QString &user) | ||
| { | ||
| m_authenticationUser = user; | ||
| Q_EMIT authPendingChanged(); | ||
| } | ||
|
|
||
| void GreeterProxy::finishAuthentication() | ||
| { | ||
| if (!authPending()) | ||
| return; | ||
|
|
||
| m_authenticationUser.clear(); | ||
| Q_EMIT authPendingChanged(); | ||
| } | ||
|
|
||
| /////////// | ||
| // Slots // | ||
| /////////// | ||
|
|
@@ -227,6 +242,9 @@ void GreeterProxy::hybridSleep() | |
|
|
||
| void GreeterProxy::login(const QString &user, const QString &password, const int sessionIndex) | ||
| { | ||
| if (authPending()) | ||
| return; | ||
|
|
||
| if (!m_socket->isValid()) { | ||
| qCDebug(lcTlGreeter) << "Socket is not valid. Local password check."; | ||
| if (localValidation(user, password)) { | ||
|
|
@@ -243,11 +261,15 @@ void GreeterProxy::login(const QString &user, const QString &password, const int | |
| // send command to the daemon | ||
| QString name = sessionModel()->data(index, SessionModel::FileRole).toString(); | ||
| qCInfo(lcTlGreeter) << "Logging user" << user << "in with session" << name; | ||
| beginAuthentication(user); | ||
| SocketWriter(m_socket) << quint32(GreeterMessages::Login) << user << password << name; | ||
| } | ||
|
|
||
| void GreeterProxy::unlock(const QString &user, const QString &password) | ||
| { | ||
| if (authPending()) | ||
| return; | ||
|
|
||
| if (!m_socket->isValid()) { | ||
| qCDebug(lcTlGreeter) << "Socket is not valid. Local password check."; | ||
| if (localValidation(user, password)) { | ||
|
|
@@ -261,6 +283,7 @@ void GreeterProxy::unlock(const QString &user, const QString &password) | |
| auto userInfo = userModel()->get(user); | ||
| if (userInfo.isValid()) { | ||
| qCInfo(lcTlGreeter) << "Unlocking user" << user; | ||
| beginAuthentication(user); | ||
| SocketWriter(m_socket) << quint32(GreeterMessages::Unlock) << user << password; | ||
| } | ||
| } | ||
|
|
@@ -469,12 +492,14 @@ void GreeterProxy::disconnected() | |
| { | ||
| qCWarning(lcTlGreeter) << "Disconnected from the ddm"; | ||
|
|
||
| finishAuthentication(); | ||
| Q_EMIT socketDisconnected(); | ||
| } | ||
|
|
||
| void GreeterProxy::error() | ||
| { | ||
| qCCritical(lcTlGreeter) << "Socket error: " << m_socket->errorString(); | ||
| finishAuthentication(); | ||
| } | ||
|
|
||
| void GreeterProxy::readyRead() | ||
|
|
@@ -556,6 +581,7 @@ void GreeterProxy::readyRead() | |
|
|
||
| qCDebug(lcTlGreeter) << "Message received from daemon: LoginFailed" << user; | ||
|
|
||
| finishAuthentication(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 两处清理的判据不一致: 考虑到 |
||
| Q_EMIT failedAttemptsChanged(++m_failedAttempts); | ||
| } break; | ||
| case DaemonMessages::InformationMessage: { | ||
|
|
@@ -592,6 +618,9 @@ void GreeterProxy::readyRead() | |
| if (!input.commitTransaction()) | ||
| return; | ||
|
|
||
| if (user == m_authenticationUser) | ||
| finishAuthentication(); | ||
|
|
||
| // NOTE: maybe DDM will active dde user. | ||
| if (!userModel()->getUser(user)) { | ||
| qCInfo(lcTlGreeter) << "activate user, but switch to greeter"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pending 只有 4 个出口(
disconnected/error/LoginFailed/ 匹配用户的UserActivateMessage),既没有超时,也没有「greeter 重新出现」时的重置。而 ddm 侧现在仍有静默丢弃的路径,linuxdeepin/ddmmastersrc/daemon/Display.cpp:286:你在 12:48 的回复里把它的触发条件定位成「treeland 重启 + 旧会话仍存活」,并靠
linuxdeepin/ddm#123修掉——但那个 PR 目前还是 open。在这条路径命中期间:Login被 ddm 静默吞掉,界面只是「点了没反应」,用户再点一次即可;m_authenticationUser永远非空 → 密码框和登录按钮永久灰掉 → 用户只能重启或切 VT。这个不对称值得用一行兜底挡住(进入新一轮 greeter 会话时不可能有合法在途请求):
ShowGreeter/SwitchToGreeter分支同理。更彻底的做法是超时(仿m_undecidedTimer:超时后finishAuthentication()+ 一条提示),但一行重置已经能把「永久锁死」降级成「重进一次锁屏就好」。另外 ddm 那个分支本身建议改成
Q_EMIT loginFailed(socket, user),可以并进你已有的那个 ddm PR——客户端的状态永远只是 ddm 回包契约的镜像,契约有洞时客户端只能自保。