| 1361 | } |
| 1362 | |
| 1363 | void RecoverBox::checkSubmitFail(const MTP::Error &error) { |
| 1364 | if (MTP::IsFloodError(error)) { |
| 1365 | _submitRequest = 0; |
| 1366 | setError(tr::lng_flood_error(tr::now)); |
| 1367 | _recoverCode->showError(); |
| 1368 | return; |
| 1369 | } |
| 1370 | _submitRequest = 0; |
| 1371 | |
| 1372 | const QString &err = error.type(); |
| 1373 | if (err == u"PASSWORD_EMPTY"_q) { |
| 1374 | _newPasswordSet.fire(QByteArray()); |
| 1375 | getDelegate()->show( |
| 1376 | Ui::MakeInformBox(tr::lng_cloud_password_removed()), |
| 1377 | Ui::LayerOption::CloseOther); |
| 1378 | } else if (err == u"PASSWORD_RECOVERY_NA"_q) { |
| 1379 | closeBox(); |
| 1380 | } else if (err == u"PASSWORD_RECOVERY_EXPIRED"_q) { |
| 1381 | _recoveryExpired.fire({}); |
| 1382 | closeBox(); |
| 1383 | } else if (err == u"CODE_INVALID"_q) { |
| 1384 | setError(tr::lng_signin_wrong_code(tr::now)); |
| 1385 | _recoverCode->selectAll(); |
| 1386 | _recoverCode->setFocus(); |
| 1387 | _recoverCode->showError(); |
| 1388 | } else { |
| 1389 | setError(Logs::DebugEnabled() // internal server error |
| 1390 | ? (err + ": " + error.description()) |
| 1391 | : Lang::Hard::ServerError()); |
| 1392 | _recoverCode->setFocus(); |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | RecoveryEmailValidation ConfirmRecoveryEmail( |
| 1397 | not_null<Main::Session*> session, |
nothing calls this directly
no test coverage detected