diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs index b0830d0c..65efbfd1 100644 --- a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs +++ b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs @@ -344,24 +344,32 @@ public class UserService : IUserService public async Task SendVerificationCodeResetPassword(User user) { - if (!string.IsNullOrEmpty(user.Email) && !string.IsNullOrEmpty(user.Phone)) - { - return false; - } - var db = _services.GetRequiredService(); User? record = null; - if (!string.IsNullOrEmpty(user.Email)) + if (!string.IsNullOrWhiteSpace(_user.Id)) { - record = db.GetUserByEmail(user.Email); + record = db.GetUserById(_user.Id); + } + else + { + if (!string.IsNullOrEmpty(user.Email) && !string.IsNullOrEmpty(user.Phone)) + { + return false; + } + + if (!string.IsNullOrEmpty(user.Email)) + { + record = db.GetUserByEmail(user.Email); + } + + if (!string.IsNullOrEmpty(user.Phone)) + { + record = db.GetUserByPhone(user.Phone); + } } - if (!string.IsNullOrEmpty(user.Phone)) - { - record = db.GetUserByPhone(user.Phone); - } if (record == null) { return false;