Skip to content

Commit

Permalink
feat: no password unlock
Browse files Browse the repository at this point in the history
Log:
  • Loading branch information
Decodetalkers committed Oct 13, 2023
1 parent 4f6aff7 commit 09adcde
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/dde-lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ int main(int argc, char *argv[])
if (model->isUseWayland()) {
QObject::connect(lockFrame, &LockFrame::requestDisableGlobalShortcutsForWayland, worker, &LockWorker::disableGlobalShortcutsForWayland);
}
QObject::connect(lockFrame, &LockFrame::requestCheckAccount, worker, &LockWorker::checkAccount);
lockFrame->setVisible(model->visible());
emit lockService.Visible(true);
return lockFrame;
Expand Down
1 change: 1 addition & 0 deletions src/dde-lock/lockframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ LockFrame::LockFrame(SessionBaseModel *const model, QWidget *parent)
emit requestEnableHotzone(true);
emit authFinished();
});
connect(m_lockContent, &LockContent::requestCheckAccount, this, &LockFrame::requestCheckAccount);
connect(model, &SessionBaseModel::showUserList, this, &LockFrame::showUserList);
connect(model, &SessionBaseModel::showLockScreen, this, &LockFrame::showLockScreen);
connect(model, &SessionBaseModel::showShutdown, this, &LockFrame::showShutdown);
Expand Down
1 change: 1 addition & 0 deletions src/dde-lock/lockframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class LockFrame: public FullscreenBackground
void sendTokenToAuth(const QString &account, const int authType, const QString &token);
void requestEndAuthentication(const QString &account, const int authType);
void authFinished();
void requestCheckAccount(const QString &account);

public slots:
void showUserList();
Expand Down
13 changes: 13 additions & 0 deletions src/dde-lock/lockworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ void LockWorker::createAuthentication(const QString &account)
std::shared_ptr<User> user_ptr = m_model->findUserByName(account);
if (user_ptr) {
user_ptr->updatePasswordExpiredInfo();
if (user_ptr->isNoPasswordLogin()) {
qInfo() << "User is no password login";
return;
}
}

m_account = account;
Expand Down Expand Up @@ -763,3 +767,12 @@ void LockWorker::disableGlobalShortcutsForWayland(const bool enable)
qWarning() << "call setActiveByUniqueName failed" << reply.error();
}
}

void LockWorker::checkAccount(const QString &account)
{
Q_UNUSED(account)
if (m_model->currentUser() && m_model->currentUser()->isNoPasswordLogin()) {
qInfo() << "Current user has set 'no password login' : " << account;
onAuthFinished();
}
}
2 changes: 2 additions & 0 deletions src/dde-lock/lockworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public slots:

void disableGlobalShortcutsForWayland(const bool enable);

void checkAccount(const QString &account);

private:
void initConnections();
void initData();
Expand Down

0 comments on commit 09adcde

Please sign in to comment.