tdesktop/Telegram/SourceFiles/intro/intro_password_check.h

83 lines
1.9 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
2019-11-26 11:10:44 +00:00
#include "intro/intro_step.h"
#include "core/core_cloud_password.h"
2018-08-10 19:19:46 +00:00
#include "mtproto/sender.h"
2019-11-27 08:33:18 +00:00
#include "base/timer.h"
namespace Ui {
2016-11-24 19:28:23 +00:00
class InputField;
class PasswordInput;
class RoundButton;
class LinkButton;
} // namespace Ui
2016-11-24 19:28:23 +00:00
namespace Intro {
2019-11-26 11:10:44 +00:00
namespace details {
2016-11-24 19:28:23 +00:00
2019-11-27 09:45:23 +00:00
class PasswordCheckWidget final : public Step {
public:
2019-11-27 09:45:23 +00:00
PasswordCheckWidget(
2019-07-24 08:46:23 +00:00
QWidget *parent,
not_null<Main::Account*> account,
2019-11-26 11:10:44 +00:00
not_null<Data*> data);
2016-11-24 19:28:23 +00:00
void setInnerFocus() override;
void activate() override;
void cancelled() override;
2016-11-24 19:28:23 +00:00
void submit() override;
rpl::producer<QString> nextButtonText() const override;
2016-11-24 19:28:23 +00:00
protected:
void resizeEvent(QResizeEvent *e) override;
private:
2019-11-27 08:33:18 +00:00
void toRecover();
void toPassword();
2019-11-26 14:27:09 +00:00
int errorTop() const override;
void showReset();
void refreshLang();
void updateControlsGeometry();
2016-11-24 19:28:23 +00:00
void pwdSubmitDone(bool recover, const MTPauth_Authorization &result);
2021-03-12 12:48:00 +00:00
void pwdSubmitFail(const MTP::Error &error);
void codeSubmitFail(const MTP::Error &error);
void recoverStartFail(const MTP::Error &error);
2016-11-24 19:28:23 +00:00
void recoverStarted(const MTPauth_PasswordRecovery &result);
2016-11-24 19:28:23 +00:00
void updateDescriptionText();
2018-08-10 19:19:46 +00:00
void handleSrpIdInvalid();
void requestPasswordData();
void checkPasswordHash();
void passwordChecked();
void serverError();
Core::CloudPasswordCheckRequest _request;
crl::time _lastSrpIdInvalidTime = 0;
2018-08-10 19:19:46 +00:00
bytes::vector _passwordHash;
bool _hasRecovery = false;
bool _notEmptyPassport = false;
QString _hint, _emailPattern;
object_ptr<Ui::PasswordInput> _pwdField;
object_ptr<Ui::FlatLabel> _pwdHint;
object_ptr<Ui::InputField> _codeField;
object_ptr<Ui::LinkButton> _toRecover;
object_ptr<Ui::LinkButton> _toPassword;
mtpRequestId _sentRequest = 0;
};
2016-11-24 19:28:23 +00:00
2019-11-26 11:10:44 +00:00
} // namespace details
2016-11-24 19:28:23 +00:00
} // namespace Intro