Login: warning on phone_number mismatch

This commit is contained in:
Wizou 2022-10-13 10:07:46 +02:00
parent 88d54eb5a6
commit 2e84061b4d
2 changed files with 6 additions and 3 deletions

View file

@ -92,9 +92,9 @@ Since version 3.0.0, a new approach to login/configuration has been added. Some
```csharp
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)
switch (await client.Login(loginInfo)) // returns which config info is needed to continue login

View file

@ -1119,7 +1119,10 @@ namespace WTelegram
authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name);
}
#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>