清理代码
This commit is contained in:
parent
87a8c989bf
commit
854d367ff1
@ -38,9 +38,9 @@ public class OAuthController : IDynamicApiController
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<MiniProgramLoginOutput> Login([FromBody] MiniProgramLoginInput input)
|
public async Task<MiniProgramLoginOutput> Login([FromBody] MiniProgramLoginInput input)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(input.Password) && string.IsNullOrEmpty(input.VerificationCode))
|
if (string.IsNullOrEmpty(input.Password) )
|
||||||
{
|
{
|
||||||
throw Oops.Bah("密码和验证码至少提供一个");
|
throw Oops.Bah("密码必填");
|
||||||
}
|
}
|
||||||
|
|
||||||
var appUser = await _appUserRepository.GetFirstAsync(x => x.Mobile == input.Mobile);
|
var appUser = await _appUserRepository.GetFirstAsync(x => x.Mobile == input.Mobile);
|
||||||
@ -62,17 +62,6 @@ public class OAuthController : IDynamicApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(input.VerificationCode))
|
|
||||||
{
|
|
||||||
var cacheKey = $"{SmsCodeCachePrefix}{input.Mobile}";
|
|
||||||
string cachedCode = null;
|
|
||||||
if (!_memoryCache.TryGetValue(cacheKey, out cachedCode) || cachedCode != input.VerificationCode)
|
|
||||||
{
|
|
||||||
throw Oops.Bah("验证码错误或已过期");
|
|
||||||
}
|
|
||||||
_memoryCache.Remove(cacheKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
(string accessToken, string refreshToken) = GenerateTokens(appUser);
|
(string accessToken, string refreshToken) = GenerateTokens(appUser);
|
||||||
|
|
||||||
var userInfo = new
|
var userInfo = new
|
||||||
|
|||||||
@ -2092,12 +2092,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:YD_Event.Application.Client.Dtos.MiniProgramLoginInput.Password">
|
<member name="P:YD_Event.Application.Client.Dtos.MiniProgramLoginInput.Password">
|
||||||
<summary>
|
<summary>
|
||||||
密码(可选,与验证码至少提供一个)
|
密码
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:YD_Event.Application.Client.Dtos.MiniProgramLoginInput.VerificationCode">
|
|
||||||
<summary>
|
|
||||||
验证码(可选,与密码至少提供一个)
|
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:YD_Event.Application.Client.Dtos.MiniProgramLoginOutput">
|
<member name="T:YD_Event.Application.Client.Dtos.MiniProgramLoginOutput">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user