mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-24 15:34:20 +00:00
Fix crash in passcode setup.
This commit is contained in:
parent
c27456277e
commit
f4544b0964
@ -476,9 +476,17 @@ void AuthSession::saveSettingsDelayed(crl::time delay) {
|
||||
_saveDataTimer.callOnce(delay);
|
||||
}
|
||||
|
||||
void AuthSession::localPasscodeChanged() {
|
||||
_shouldLockAt = 0;
|
||||
_autoLockTimer.cancel();
|
||||
checkAutoLock();
|
||||
}
|
||||
|
||||
void AuthSession::checkAutoLock() {
|
||||
if (!Global::LocalPasscode()
|
||||
|| Core::App().passcodeLocked()) {
|
||||
_shouldLockAt = 0;
|
||||
_autoLockTimer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -487,6 +495,8 @@ void AuthSession::checkAutoLock() {
|
||||
const auto shouldLockInMs = Global::AutoLock() * 1000LL;
|
||||
const auto checkTimeMs = now - Core::App().lastNonIdleTime();
|
||||
if (checkTimeMs >= shouldLockInMs || (_shouldLockAt > 0 && now > _shouldLockAt + kAutoLockTimeoutLateMs)) {
|
||||
_shouldLockAt = 0;
|
||||
_autoLockTimer.cancel();
|
||||
Core::App().lockByPasscode();
|
||||
} else {
|
||||
_shouldLockAt = now + (shouldLockInMs - checkTimeMs);
|
||||
|
@ -316,6 +316,7 @@ public:
|
||||
|
||||
void checkAutoLock();
|
||||
void checkAutoLockIn(crl::time time);
|
||||
void localPasscodeChanged();
|
||||
|
||||
rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
|
@ -452,10 +452,13 @@ void PasscodeBox::save(bool force) {
|
||||
changeCloudPassword(old, pwd);
|
||||
}
|
||||
} else {
|
||||
const auto weak = make_weak(this);
|
||||
cSetPasscodeBadTries(0);
|
||||
Local::setPasscode(pwd.toUtf8());
|
||||
Auth().checkAutoLock();
|
||||
closeBox();
|
||||
Auth().localPasscodeChanged();
|
||||
if (weak) {
|
||||
closeBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user