select wrong passcode / password when showing error message

This commit is contained in:
John Preston 2015-11-24 13:29:37 +03:00
parent e5c82fad21
commit 3cf4c7f2fc
4 changed files with 6 additions and 4 deletions

View File

@ -356,6 +356,7 @@ void PasscodeBox::onSave(bool force) {
return; return;
} }
if (pwd != conf) { if (pwd != conf) {
_reenterPasscode.selectAll();
_reenterPasscode.setFocus(); _reenterPasscode.setFocus();
_reenterPasscode.showError(); _reenterPasscode.showError();
if (!conf.isEmpty()) { if (!conf.isEmpty()) {
@ -603,6 +604,8 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
} else if (err == "CODE_INVALID") { } else if (err == "CODE_INVALID") {
_error = lang(lng_signin_wrong_code); _error = lang(lng_signin_wrong_code);
update(); update();
_recoverCode.selectAll();
_recoverCode.setFocus();
_recoverCode.showError(); _recoverCode.showError();
return true; return true;
} else if (mtpIsFlood(error)) { } else if (mtpIsFlood(error)) {

View File

@ -252,7 +252,7 @@ bool IntroCode::codeSubmitFail(const RPCError &error) {
return true; return true;
} else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") { } else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") {
showError(lang(lng_bad_code)); showError(lang(lng_bad_code));
code.setFocus(); code.notaBene();
return true; return true;
} else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp } else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp
intro()->setCode(sentCode); intro()->setCode(sentCode);

View File

@ -199,6 +199,7 @@ bool IntroPwdCheck::pwdSubmitFail(const RPCError &error) {
const QString &err = error.type(); const QString &err = error.type();
if (err == "PASSWORD_HASH_INVALID") { if (err == "PASSWORD_HASH_INVALID") {
showError(lang(lng_signin_bad_password)); showError(lang(lng_signin_bad_password));
_pwdField.selectAll();
_pwdField.notaBene(); _pwdField.notaBene();
return true; return true;
} else if (err == "PASSWORD_EMPTY") { } else if (err == "PASSWORD_EMPTY") {
@ -235,6 +236,7 @@ bool IntroPwdCheck::codeSubmitFail(const RPCError &error) {
return true; return true;
} else if (err == "CODE_INVALID") { } else if (err == "CODE_INVALID") {
showError(lang(lng_signin_wrong_code)); showError(lang(lng_signin_wrong_code));
_codeField.selectAll();
_codeField.notaBene(); _codeField.notaBene();
return true; return true;
} else if (mtpIsFlood(error)) { } else if (mtpIsFlood(error)) {

View File

@ -55,13 +55,11 @@ void PasscodeWidget::onParentResize(const QSize &newSize) {
void PasscodeWidget::onSubmit() { void PasscodeWidget::onSubmit() {
if (_passcode.text().isEmpty()) { if (_passcode.text().isEmpty()) {
_passcode.setFocus();
_passcode.notaBene(); _passcode.notaBene();
return; return;
} }
if (!passcodeCanTry()) { if (!passcodeCanTry()) {
_error = lang(lng_flood_error); _error = lang(lng_flood_error);
_passcode.setFocus();
_passcode.notaBene(); _passcode.notaBene();
update(); update();
return; return;
@ -100,7 +98,6 @@ void PasscodeWidget::onSubmit() {
void PasscodeWidget::onError() { void PasscodeWidget::onError() {
_error = lang(lng_passcode_wrong); _error = lang(lng_passcode_wrong);
_passcode.selectAll(); _passcode.selectAll();
_passcode.setFocus();
_passcode.notaBene(); _passcode.notaBene();
update(); update();
} }