Merge pull request #478 from Qtoss-AI/hdongDev
hdong:keep same logic with name.
This commit is contained in:
commit
98f1a03495
|
|
@ -10,6 +10,6 @@ public interface IUserService
|
|||
Task<Token> ActiveUser(UserActivationModel model);
|
||||
Task<Token?> GetToken(string authorization);
|
||||
Task<User> GetMyProfile();
|
||||
Task<bool> VerifyUserUnique(string userName);
|
||||
Task<bool> VerifyEmailUnique(string email);
|
||||
Task<bool> VerifyUserNameExisting(string userName);
|
||||
Task<bool> VerifyEmailExisting(string email);
|
||||
}
|
||||
|
|
@ -16,8 +16,8 @@ public class UserService : IUserService
|
|||
private readonly ILogger _logger;
|
||||
private readonly AccountSetting _setting;
|
||||
|
||||
public UserService(IServiceProvider services,
|
||||
IUserIdentity user,
|
||||
public UserService(IServiceProvider services,
|
||||
IUserIdentity user,
|
||||
ILogger<UserService> logger,
|
||||
AccountSetting setting)
|
||||
{
|
||||
|
|
@ -92,7 +92,7 @@ public class UserService : IUserService
|
|||
|
||||
User? user = record;
|
||||
var hooks = _services.GetServices<IAuthenticationHook>();
|
||||
if (record == null || record.Source != "internal")
|
||||
if (record == null || record.Source != "internal")
|
||||
{
|
||||
// check 3rd party user
|
||||
foreach (var hook in hooks)
|
||||
|
|
@ -264,27 +264,27 @@ public class UserService : IUserService
|
|||
return token;
|
||||
}
|
||||
|
||||
public async Task<bool> VerifyUserUnique(string userName)
|
||||
public async Task<bool> VerifyUserNameExisting(string userName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userName))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var user = db.GetUserByUserName(userName);
|
||||
if (user == null)
|
||||
if (user != null)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> VerifyEmailUnique(string email)
|
||||
public async Task<bool> VerifyEmailExisting(string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(email))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var emailName = db.GetUserByEmail(email);
|
||||
if (emailName == null)
|
||||
if (emailName != null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class UserController : ControllerBase
|
|||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("/sso/{provider}")]
|
||||
public async Task<IActionResult> Authorize([FromRoute] string provider,string redirectUrl)
|
||||
public async Task<IActionResult> Authorize([FromRoute] string provider, string redirectUrl)
|
||||
{
|
||||
return Challenge(new AuthenticationProperties { RedirectUri = redirectUrl }, provider);
|
||||
}
|
||||
|
|
@ -96,15 +96,15 @@ public class UserController : ControllerBase
|
|||
}
|
||||
|
||||
[HttpGet("/user/name/existing")]
|
||||
public async Task<bool> VerifyUserUnique([FromQuery] string userName)
|
||||
public async Task<bool> VerifyUserNameExisting([FromQuery] string userName)
|
||||
{
|
||||
return await _userService.VerifyUserUnique(userName);
|
||||
return await _userService.VerifyUserNameExisting(userName);
|
||||
}
|
||||
|
||||
[HttpGet("/user/email/existing")]
|
||||
public async Task<bool> VerifyEmailUnique([FromQuery] string email)
|
||||
public async Task<bool> VerifyEmailExisting([FromQuery] string email)
|
||||
{
|
||||
return await _userService.VerifyEmailUnique(email);
|
||||
return await _userService.VerifyEmailExisting(email);
|
||||
}
|
||||
|
||||
#region Avatar
|
||||
|
|
|
|||
Loading…
Reference in a new issue