mirror of https://github.com/procxx/kepka.git
Fixed phone confirm: sending correct hash (from auth.sentCode).
This commit is contained in:
parent
5df54371b5
commit
bcd3f6ef3d
|
@ -48,7 +48,7 @@ ConfirmPhoneBox::ConfirmPhoneBox(QWidget *parent, const QString &phone, const QS
|
||||||
setParent(parent);
|
setParent(parent);
|
||||||
|
|
||||||
MTPaccount_SendConfirmPhoneCode::Flags flags = 0;
|
MTPaccount_SendConfirmPhoneCode::Flags flags = 0;
|
||||||
_sendCodeRequestId = MTP::send(MTPaccount_SendConfirmPhoneCode(MTP_flags(flags), MTP_string(hash), MTPBool()), rpcDone(&ConfirmPhoneBox::sendCodeDone), rpcFail(&ConfirmPhoneBox::sendCodeFail));
|
_sendCodeRequestId = MTP::send(MTPaccount_SendConfirmPhoneCode(MTP_flags(flags), MTP_string(_hash), MTPBool()), rpcDone(&ConfirmPhoneBox::sendCodeDone), rpcFail(&ConfirmPhoneBox::sendCodeFail));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) {
|
void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) {
|
||||||
|
@ -61,6 +61,7 @@ void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) {
|
||||||
case mtpc_auth_sentCodeTypeCall: _sentCodeLength = resultInner.vtype.c_auth_sentCodeTypeCall().vlength.v; break;
|
case mtpc_auth_sentCodeTypeCall: _sentCodeLength = resultInner.vtype.c_auth_sentCodeTypeCall().vlength.v; break;
|
||||||
case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break;
|
case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break;
|
||||||
}
|
}
|
||||||
|
_phoneHash = qs(resultInner.vphone_code_hash);
|
||||||
if (resultInner.has_next_type() && resultInner.vnext_type.type() == mtpc_auth_codeTypeCall) {
|
if (resultInner.has_next_type() && resultInner.vnext_type.type() == mtpc_auth_codeTypeCall) {
|
||||||
setCallStatus({ CallState::Waiting, resultInner.has_timeout() ? resultInner.vtimeout.v : 60 });
|
setCallStatus({ CallState::Waiting, resultInner.has_timeout() ? resultInner.vtimeout.v : 60 });
|
||||||
} else {
|
} else {
|
||||||
|
@ -129,7 +130,7 @@ void ConfirmPhoneBox::onCallStatusTimer() {
|
||||||
if (--_callStatus.timeout <= 0) {
|
if (--_callStatus.timeout <= 0) {
|
||||||
_callStatus.state = CallState::Calling;
|
_callStatus.state = CallState::Calling;
|
||||||
_callTimer.stop();
|
_callTimer.stop();
|
||||||
MTP::send(MTPauth_ResendCode(MTP_string(_phone), MTP_string(_hash)), rpcDone(&ConfirmPhoneBox::callDone));
|
MTP::send(MTPauth_ResendCode(MTP_string(_phone), MTP_string(_phoneHash)), rpcDone(&ConfirmPhoneBox::callDone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
@ -157,7 +158,7 @@ void ConfirmPhoneBox::onSendCode() {
|
||||||
|
|
||||||
showError(QString());
|
showError(QString());
|
||||||
|
|
||||||
_sendCodeRequestId = MTP::send(MTPaccount_ConfirmPhone(MTP_string(_hash), MTP_string(_code->getLastText())), rpcDone(&ConfirmPhoneBox::confirmDone), rpcFail(&ConfirmPhoneBox::confirmFail));
|
_sendCodeRequestId = MTP::send(MTPaccount_ConfirmPhone(MTP_string(_phoneHash), MTP_string(_code->getLastText())), rpcDone(&ConfirmPhoneBox::confirmDone), rpcFail(&ConfirmPhoneBox::confirmFail));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmPhoneBox::confirmDone(const MTPBool &result) {
|
void ConfirmPhoneBox::confirmDone(const MTPBool &result) {
|
||||||
|
@ -229,9 +230,9 @@ void ConfirmPhoneBox::onCodeChanged() {
|
||||||
_fixing = false;
|
_fixing = false;
|
||||||
|
|
||||||
showError(QString());
|
showError(QString());
|
||||||
//if (strict) {
|
if (strict) {
|
||||||
// onSendCode();
|
onSendCode();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmPhoneBox::showError(const QString &error) {
|
void ConfirmPhoneBox::showError(const QString &error) {
|
||||||
|
|
|
@ -82,8 +82,10 @@ private:
|
||||||
|
|
||||||
mtpRequestId _sendCodeRequestId = 0;
|
mtpRequestId _sendCodeRequestId = 0;
|
||||||
|
|
||||||
QString _phone;
|
// _hash from the link for account.sendConfirmPhoneCode call.
|
||||||
QString _hash;
|
// _phoneHash from auth.sentCode for account.confirmPhone call.
|
||||||
|
QString _phone, _hash;
|
||||||
|
QString _phoneHash;
|
||||||
|
|
||||||
// If we receive the code length, we autosubmit _code field when enough symbols is typed.
|
// If we receive the code length, we autosubmit _code field when enough symbols is typed.
|
||||||
int _sentCodeLength = 0;
|
int _sentCodeLength = 0;
|
||||||
|
|
Loading…
Reference in New Issue