From 3cf4c7f2fcaa165a1a19d567ecb1be9d5ae997e9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 24 Nov 2015 13:29:37 +0300 Subject: [PATCH] select wrong passcode / password when showing error message --- Telegram/SourceFiles/boxes/passcodebox.cpp | 3 +++ Telegram/SourceFiles/intro/introcode.cpp | 2 +- Telegram/SourceFiles/intro/intropwdcheck.cpp | 2 ++ Telegram/SourceFiles/passcodewidget.cpp | 3 --- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/passcodebox.cpp b/Telegram/SourceFiles/boxes/passcodebox.cpp index 784d23bf9..b98f8957d 100644 --- a/Telegram/SourceFiles/boxes/passcodebox.cpp +++ b/Telegram/SourceFiles/boxes/passcodebox.cpp @@ -356,6 +356,7 @@ void PasscodeBox::onSave(bool force) { return; } if (pwd != conf) { + _reenterPasscode.selectAll(); _reenterPasscode.setFocus(); _reenterPasscode.showError(); if (!conf.isEmpty()) { @@ -603,6 +604,8 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) { } else if (err == "CODE_INVALID") { _error = lang(lng_signin_wrong_code); update(); + _recoverCode.selectAll(); + _recoverCode.setFocus(); _recoverCode.showError(); return true; } else if (mtpIsFlood(error)) { diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index 2dfce9288..bf23e6235 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -252,7 +252,7 @@ bool IntroCode::codeSubmitFail(const RPCError &error) { return true; } else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") { showError(lang(lng_bad_code)); - code.setFocus(); + code.notaBene(); return true; } else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp intro()->setCode(sentCode); diff --git a/Telegram/SourceFiles/intro/intropwdcheck.cpp b/Telegram/SourceFiles/intro/intropwdcheck.cpp index e36ad72f1..211beffd4 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.cpp +++ b/Telegram/SourceFiles/intro/intropwdcheck.cpp @@ -199,6 +199,7 @@ bool IntroPwdCheck::pwdSubmitFail(const RPCError &error) { const QString &err = error.type(); if (err == "PASSWORD_HASH_INVALID") { showError(lang(lng_signin_bad_password)); + _pwdField.selectAll(); _pwdField.notaBene(); return true; } else if (err == "PASSWORD_EMPTY") { @@ -235,6 +236,7 @@ bool IntroPwdCheck::codeSubmitFail(const RPCError &error) { return true; } else if (err == "CODE_INVALID") { showError(lang(lng_signin_wrong_code)); + _codeField.selectAll(); _codeField.notaBene(); return true; } else if (mtpIsFlood(error)) { diff --git a/Telegram/SourceFiles/passcodewidget.cpp b/Telegram/SourceFiles/passcodewidget.cpp index f6b375dd8..ff26cf5ed 100644 --- a/Telegram/SourceFiles/passcodewidget.cpp +++ b/Telegram/SourceFiles/passcodewidget.cpp @@ -55,13 +55,11 @@ void PasscodeWidget::onParentResize(const QSize &newSize) { void PasscodeWidget::onSubmit() { if (_passcode.text().isEmpty()) { - _passcode.setFocus(); _passcode.notaBene(); return; } if (!passcodeCanTry()) { _error = lang(lng_flood_error); - _passcode.setFocus(); _passcode.notaBene(); update(); return; @@ -100,7 +98,6 @@ void PasscodeWidget::onSubmit() { void PasscodeWidget::onError() { _error = lang(lng_passcode_wrong); _passcode.selectAll(); - _passcode.setFocus(); _passcode.notaBene(); update(); }