mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Login: warning on phone_number mismatch
This commit is contained in:
parent
88d54eb5a6
commit
2e84061b4d
|
|
@ -92,9 +92,9 @@ Since version 3.0.0, a new approach to login/configuration has been added. Some
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH");
|
WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH");
|
||||||
await DoLogin("+12025550156");
|
await DoLogin("+12025550156"); // user's phone_number
|
||||||
|
|
||||||
async Task DoLogin(string loginInfo) // add this method to your code
|
async Task DoLogin(string loginInfo) // (add this method to your code)
|
||||||
{
|
{
|
||||||
while (client.User == null)
|
while (client.User == null)
|
||||||
switch (await client.Login(loginInfo)) // returns which config info is needed to continue login
|
switch (await client.Login(loginInfo)) // returns which config info is needed to continue login
|
||||||
|
|
|
||||||
|
|
@ -1119,7 +1119,10 @@ namespace WTelegram
|
||||||
authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name);
|
authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name);
|
||||||
}
|
}
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
return LoginAlreadyDone(authorization);
|
LoginAlreadyDone(authorization);
|
||||||
|
if (User.phone != string.Concat(phone_number.Where(char.IsDigit)))
|
||||||
|
Helpers.Log(3, $"Mismatched phone_number (+{User.phone} != {phone_number}). Fix this to avoid verification code each time");
|
||||||
|
return User;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary><b>[Not recommended]</b> You can use this if you have already obtained a login authorization manually</summary>
|
/// <summary><b>[Not recommended]</b> You can use this if you have already obtained a login authorization manually</summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue