2015-04-02 10:33:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2015-04-02 10:33:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-07 18:05:28 +00:00
|
|
|
#include "ui/flatinput.h"
|
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 {
|
|
|
|
class RoundButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2016-03-14 16:59:18 +00:00
|
|
|
class IntroPwdCheck final : public IntroStep {
|
2015-04-02 10:33:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
IntroPwdCheck(IntroWidget *parent);
|
|
|
|
|
2016-03-21 18:41:39 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_error(float64 ms, bool timer);
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-03-14 16:59:18 +00:00
|
|
|
void activate() override;
|
|
|
|
void cancelled() override;
|
|
|
|
void onSubmit() override;
|
2015-04-02 10:33:19 +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);
|
|
|
|
|
|
|
|
void recoverStarted(const MTPauth_PasswordRecovery &result);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void onSubmitPwd(bool force = false);
|
|
|
|
void onToRecover();
|
|
|
|
void onToPassword();
|
|
|
|
void onInputChange();
|
|
|
|
void onCheckRequest();
|
2015-04-04 20:01:34 +00:00
|
|
|
void onToReset();
|
|
|
|
void onReset();
|
|
|
|
void onResetSure();
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
private:
|
2016-11-04 19:50:35 +00:00
|
|
|
void showError(const QString &error);
|
2015-04-02 10:33:19 +00:00
|
|
|
void stopCheck();
|
|
|
|
|
2015-04-04 20:01:34 +00:00
|
|
|
void deleteDone(const MTPBool &result);
|
|
|
|
bool deleteFail(const RPCError &error);
|
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
QString _error;
|
2015-12-08 12:33:37 +00:00
|
|
|
anim::fvalue a_errorAlpha;
|
|
|
|
Animation _a_error;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
ChildWidget<Ui::RoundButton> _next;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
QRect _textRect;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
QByteArray _salt;
|
|
|
|
bool _hasRecovery;
|
|
|
|
QString _hint, _emailPattern;
|
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
ChildWidget<FlatInput> _pwdField;
|
|
|
|
ChildWidget<FlatInput> _codeField;
|
|
|
|
ChildWidget<LinkButton> _toRecover;
|
|
|
|
ChildWidget<LinkButton> _toPassword;
|
|
|
|
ChildWidget<LinkButton> _reset;
|
|
|
|
mtpRequestId _sentRequest = 0;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
Text _hintText;
|
|
|
|
|
|
|
|
QByteArray _pwdSalt;
|
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
ChildObject<QTimer> _checkRequest;
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
};
|