2015-04-02 13:33:19 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-04-02 13:33:19 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-11-26 14:10:44 +03:00
|
|
|
#include "intro/intro_step.h"
|
|
|
|
#include "core/core_cloud_password.h"
|
2018-08-10 22:19:46 +03:00
|
|
|
#include "mtproto/sender.h"
|
2019-11-27 11:33:18 +03:00
|
|
|
#include "base/timer.h"
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-11-04 22:50:35 +03:00
|
|
|
namespace Ui {
|
2016-11-24 22:28:23 +03:00
|
|
|
class InputField;
|
|
|
|
class PasswordInput;
|
2016-11-04 22:50:35 +03:00
|
|
|
class RoundButton;
|
2016-11-11 16:46:04 +03:00
|
|
|
class LinkButton;
|
2016-11-04 22:50:35 +03:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
namespace Intro {
|
2019-11-26 14:10:44 +03:00
|
|
|
namespace details {
|
2016-11-24 22:28:23 +03:00
|
|
|
|
2019-11-27 12:45:23 +03:00
|
|
|
class PasswordCheckWidget final : public Step {
|
2015-04-02 13:33:19 +03:00
|
|
|
public:
|
2019-11-27 12:45:23 +03:00
|
|
|
PasswordCheckWidget(
|
2019-07-24 10:46:23 +02:00
|
|
|
QWidget *parent,
|
|
|
|
not_null<Main::Account*> account,
|
2019-11-26 14:10:44 +03:00
|
|
|
not_null<Data*> data);
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
void setInnerFocus() override;
|
2016-03-14 19:59:18 +03:00
|
|
|
void activate() override;
|
|
|
|
void cancelled() override;
|
2016-11-24 22:28:23 +03:00
|
|
|
void submit() override;
|
2019-06-18 18:53:27 +02:00
|
|
|
rpl::producer<QString> nextButtonText() const override;
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2015-04-02 13:33:19 +03:00
|
|
|
|
|
|
|
private:
|
2019-11-27 11:33:18 +03:00
|
|
|
void toRecover();
|
|
|
|
void toPassword();
|
|
|
|
|
2019-11-26 17:27:09 +03:00
|
|
|
int errorTop() const override;
|
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
void showReset();
|
2017-05-30 16:54:05 +03:00
|
|
|
void refreshLang();
|
|
|
|
void updateControlsGeometry();
|
2016-12-13 20:07:56 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
void pwdSubmitDone(bool recover, const MTPauth_Authorization &result);
|
2021-03-12 16:48:00 +04:00
|
|
|
void pwdSubmitFail(const MTP::Error &error);
|
2021-07-30 17:33:26 +03:00
|
|
|
void codeSubmitDone(const QString &code, const MTPBool &result);
|
2021-03-12 16:48:00 +04:00
|
|
|
void codeSubmitFail(const MTP::Error &error);
|
|
|
|
void recoverStartFail(const MTP::Error &error);
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
void recoverStarted(const MTPauth_PasswordRecovery &result);
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
void updateDescriptionText();
|
2018-08-10 22:19:46 +03:00
|
|
|
void handleSrpIdInvalid();
|
|
|
|
void requestPasswordData();
|
|
|
|
void checkPasswordHash();
|
|
|
|
void passwordChecked();
|
|
|
|
void serverError();
|
|
|
|
|
2021-07-30 17:33:26 +03:00
|
|
|
Core::CloudPasswordState _passwordState;
|
2019-02-19 10:57:53 +04:00
|
|
|
crl::time _lastSrpIdInvalidTime = 0;
|
2018-08-10 22:19:46 +03:00
|
|
|
bytes::vector _passwordHash;
|
2021-07-30 17:33:26 +03:00
|
|
|
QString _emailPattern;
|
2015-04-02 13:33:19 +03:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
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;
|
2016-11-04 22:50:35 +03:00
|
|
|
mtpRequestId _sentRequest = 0;
|
2015-04-02 13:33:19 +03:00
|
|
|
|
|
|
|
};
|
2016-11-24 22:28:23 +03:00
|
|
|
|
2019-11-26 14:10:44 +03:00
|
|
|
} // namespace details
|
2016-11-24 22:28:23 +03:00
|
|
|
} // namespace Intro
|