You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed the latest version (8.4.1) of the code. I am trying to implement a login authorization feature that sends a verification code through the web interface. However, after running the code, no verification code is being sent. Can you please help me review my code to see if there is an issue?
`
/**
* Session invalidation rendering verification code form
*/
public function login()
{
try {
$data = $this->vali(['telegram_id.require' => 'Account ID cannot be empty!']);
$account = PluginTelegramAccount::getTelegramId($data['telegram_id']);
$session_file = syspath('madeline')."\session{$data['telegram_id']}.madeline";
if (!file_exists($session_file)) {
$settings = new Settings;
$appInfo = (new \danog\MadelineProto\Settings\AppInfo())->setApiId(intval($account['api_id']))->setApiHash($account['api_hash']);
$settings->setAppInfo($appInfo);
$MadelineProto =new \danog\MadelineProto\API($session_file,$settings);
$response = $MadelineProto->phoneLogin($account['phone_number']);
$this->fetch('sms_code',['vo' => $account]);
}else{
$this->success('Authorized, no need to log in again');
}
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $exception) {
$this->error($exception->getMessage());
}
}
/**
* Submit verification code and complete login
*/
public function submitCode()
{
try {
$data = $this->_vali([
'code.require' => 'code cannot be empty!',
'telegram_id.require' => 'Account ID cannot be empty!'
]);
$session_file = syspath('madeline')."\session_{$data['telegram_id']}.madeline";
$this->MadelineProto = new API($session_file);
// Complete login using verification code
$this->MadelineProto->completePhoneLogin($data['code']);
$this->success('Authorization successful, login completed!');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $exception) {
$this->error($exception->getMessage());
}
}`
The text was updated successfully, but these errors were encountered:
I have installed the latest version (8.4.1) of the code. I am trying to implement a login authorization feature that sends a verification code through the web interface. However, after running the code, no verification code is being sent. Can you please help me review my code to see if there is an issue?
`
/**
* Session invalidation rendering verification code form
*/
public function login()
{
try {
$data = $this->vali(['telegram_id.require' => 'Account ID cannot be empty!']);
$account = PluginTelegramAccount::getTelegramId($data['telegram_id']);
$session_file = syspath('madeline')."\session{$data['telegram_id']}.madeline";
if (!file_exists($session_file)) {
$settings = new Settings;
$appInfo = (new \danog\MadelineProto\Settings\AppInfo())->setApiId(intval($account['api_id']))->setApiHash($account['api_hash']);
$settings->setAppInfo($appInfo);
$MadelineProto =new \danog\MadelineProto\API($session_file,$settings);
$response = $MadelineProto->phoneLogin($account['phone_number']);
$this->fetch('sms_code',['vo' => $account]);
}else{
$this->success('Authorized, no need to log in again');
}
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $exception) {
$this->error($exception->getMessage());
}
}
The text was updated successfully, but these errors were encountered: