mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 13:29:48 +01:00
auth: don't start pam conversation before the initial input happens (#409)
After realizing that pam modules sometimes implement a timeout, i think it is not worth starting the convo it right away. Now you won't get the initial PAM_PROMPT any more. Prompt will be initialized to "Password: ", which is most commonly what you get from pam. Subsequent prompts (e.g. 2fa) will be handled however.
This commit is contained in:
parent
e72f601209
commit
3bedae4436
1 changed files with 3 additions and 1 deletions
|
@ -32,7 +32,7 @@ int conv(int num_msg, const struct pam_message** msg, struct pam_response** resp
|
||||||
|
|
||||||
// Some pam configurations ask for the password twice for whatever reason (Fedora su for example)
|
// Some pam configurations ask for the password twice for whatever reason (Fedora su for example)
|
||||||
// When the prompt is the same as the last one, I guess our answer can be the same.
|
// When the prompt is the same as the last one, I guess our answer can be the same.
|
||||||
if (initialPrompt || PROMPTCHANGED) {
|
if (!initialPrompt && PROMPTCHANGED) {
|
||||||
CONVERSATIONSTATE->prompt = PROMPT;
|
CONVERSATIONSTATE->prompt = PROMPT;
|
||||||
g_pAuth->waitForInput();
|
g_pAuth->waitForInput();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ static void passwordCheckTimerCallback(std::shared_ptr<CTimer> self, void* data)
|
||||||
void CAuth::start() {
|
void CAuth::start() {
|
||||||
std::thread([this]() {
|
std::thread([this]() {
|
||||||
resetConversation();
|
resetConversation();
|
||||||
|
m_sConversationState.prompt = "Password: ";
|
||||||
|
waitForInput();
|
||||||
auth();
|
auth();
|
||||||
|
|
||||||
g_pHyprlock->addTimer(std::chrono::milliseconds(1), passwordCheckTimerCallback, nullptr);
|
g_pHyprlock->addTimer(std::chrono::milliseconds(1), passwordCheckTimerCallback, nullptr);
|
||||||
|
|
Loading…
Reference in a new issue