2015-04-02 10:33:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-04-02 10:33:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-03-14 16:59:18 +00:00
|
|
|
#include "intro/introwidget.h"
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
namespace Ui {
|
2016-11-24 19:28:23 +00:00
|
|
|
class InputField;
|
|
|
|
class PasswordInput;
|
2016-11-04 19:50:35 +00:00
|
|
|
class RoundButton;
|
2016-11-11 13:46:04 +00:00
|
|
|
class LinkButton;
|
2016-11-04 19:50:35 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
namespace Intro {
|
|
|
|
|
|
|
|
class PwdCheckWidget : public Widget::Step {
|
2015-04-02 10:33:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-11-24 19:28:23 +00:00
|
|
|
PwdCheckWidget(QWidget *parent, Widget::Data *data);
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void setInnerFocus() override;
|
2016-03-14 16:59:18 +00:00
|
|
|
void activate() override;
|
|
|
|
void cancelled() override;
|
2016-11-24 19:28:23 +00:00
|
|
|
void submit() override;
|
|
|
|
QString nextButtonText() const override;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
private slots:
|
2015-04-02 10:33:19 +00:00
|
|
|
void onToRecover();
|
|
|
|
void onToPassword();
|
|
|
|
void onInputChange();
|
|
|
|
void onCheckRequest();
|
|
|
|
|
|
|
|
private:
|
2016-12-13 17:07:56 +00:00
|
|
|
void showReset();
|
2017-05-30 13:54:05 +00:00
|
|
|
void refreshLang();
|
|
|
|
void updateControlsGeometry();
|
2016-12-13 17:07:56 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void pwdSubmitDone(bool recover, const MTPauth_Authorization &result);
|
|
|
|
bool pwdSubmitFail(const RPCError &error);
|
|
|
|
bool codeSubmitFail(const RPCError &error);
|
|
|
|
bool recoverStartFail(const RPCError &error);
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void recoverStarted(const MTPauth_PasswordRecovery &result);
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void updateDescriptionText();
|
|
|
|
void stopCheck();
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
QByteArray _salt;
|
|
|
|
bool _hasRecovery;
|
|
|
|
QString _hint, _emailPattern;
|
|
|
|
|
2016-12-13 17:07:56 +00: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 19:50:35 +00:00
|
|
|
mtpRequestId _sentRequest = 0;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
QByteArray _pwdSalt;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<QTimer> _checkRequest;
|
2016-11-04 19:50:35 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
};
|
2016-11-24 19:28:23 +00:00
|
|
|
|
|
|
|
} // namespace Intro
|