Merge pull request #34 from AnonymousDotNet/lida_Dev
fix: NullReferenceException
This commit is contained in:
commit
d9f0328837
|
|
@ -631,7 +631,7 @@ public class UserService : IUserService
|
|||
var record = db.GetUserById(curUser.Id);
|
||||
var existPhone = db.GetUserByPhone(phone);
|
||||
|
||||
if (record == null || existPhone != null)
|
||||
if (record == null || (existPhone != null && existPhone.RegionCode == regionCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public partial class MongoRepository
|
|||
public User? GetUserByPhone(string phone)
|
||||
{
|
||||
string phoneSecond = string.Empty;
|
||||
if (phone.Substring(0, 3) != "+86")
|
||||
if (phone.Length >= 4 && phone.Substring(0, 3) != "+86")
|
||||
{
|
||||
phoneSecond = $"+86{phone}";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue