2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Warn user about passport reset.

Also suggest country by phone number in passport.
This commit is contained in:
John Preston
2018-04-20 20:42:51 +04:00
parent 275ec3e679
commit ab5f35e952
15 changed files with 141 additions and 53 deletions

View File

@@ -23,6 +23,7 @@ namespace Intro {
PwdCheckWidget::PwdCheckWidget(QWidget *parent, Widget::Data *data) : Step(parent, data)
, _salt(getData()->pwdSalt)
, _hasRecovery(getData()->hasRecovery)
, _notEmptyPassport(getData()->pwdNotEmptyPassport)
, _hint(getData()->pwdHint)
, _pwdField(this, st::introPassword, langFactory(lng_signin_password))
, _pwdHint(this, st::introPasswordHint)
@@ -276,8 +277,28 @@ void PwdCheckWidget::submit() {
_codeField->showError();
return;
}
const auto send = base::lambda_guarded(this, [=] {
_sentRequest = MTP::send(
MTPauth_RecoverPassword(MTP_string(code)),
rpcDone(&PwdCheckWidget::pwdSubmitDone, true),
rpcFail(&PwdCheckWidget::codeSubmitFail));
});
_sentRequest = MTP::send(MTPauth_RecoverPassword(MTP_string(code)), rpcDone(&PwdCheckWidget::pwdSubmitDone, true), rpcFail(&PwdCheckWidget::codeSubmitFail));
if (_notEmptyPassport) {
const auto box = std::make_shared<QPointer<BoxContent>>();
const auto confirmed = [=] {
send();
if (*box) {
(*box)->closeBox();
}
};
*box = Ui::show(Box<ConfirmBox>(
lang(lng_cloud_password_passport_losing),
lang(lng_continue),
confirmed));
} else {
send();
}
} else {
hideError();