feat: 添加登陆方式设置
This commit is contained in:
parent
7b2b7490fa
commit
fcaa0244c2
|
@ -80,6 +80,18 @@ public class AppInfo
|
|||
[Display(Name = "健康检查")]
|
||||
public bool HealthCheckSetting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Display(Name = "手机登录")]
|
||||
public bool MobileLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Display(Name = "OAuth认证")]
|
||||
public bool OAuthLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -289,4 +289,20 @@ class DictService : IDict
|
|||
}
|
||||
|
||||
public bool SaveAppHealthCheck(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "健康检查", Code = value ? "1" : "0" });
|
||||
|
||||
public bool GetAppMobileLogin()
|
||||
{
|
||||
var dicts = GetAll();
|
||||
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "短信验证码登录" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
|
||||
}
|
||||
|
||||
public bool SaveAppMobileLogin(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "短信验证码登录", Code = value ? "1" : "0" });
|
||||
|
||||
public bool GetAppOAuthLogin()
|
||||
{
|
||||
var dicts = GetAll();
|
||||
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "OAuth 认证登录" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
|
||||
}
|
||||
|
||||
public bool SaveAppOAuthLogin(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "OAuth 认证登录", Code = value ? "1" : "0" });
|
||||
}
|
||||
|
|
|
@ -216,4 +216,28 @@ public interface IDict
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool SaveAppHealthCheck(bool value);
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启手机认证设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool GetAppMobileLogin();
|
||||
|
||||
/// <summary>
|
||||
/// 保存手机认证设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool SaveAppMobileLogin(bool value);
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启 OAuth 认证设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool GetAppOAuthLogin();
|
||||
|
||||
/// <summary>
|
||||
/// 保存 OAuth 认证设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool SaveAppOAuthLogin(bool value);
|
||||
}
|
||||
|
|
|
@ -86,6 +86,21 @@
|
|||
</ValidateForm>
|
||||
</AdminCard>
|
||||
|
||||
<AdminCard HeaderText="网站登录设置" AuthorizeKey="SaveAppLogin">
|
||||
<ValidateForm OnValidSubmit="OnSaveSaveAppLogin" Model="AppInfo">
|
||||
<div class="row g-3 form-inline">
|
||||
<div class="col-6 col-sm-6">
|
||||
<Toggle @bind-Value="AppInfo.MobileLogin" OnText="启用" OffText="关闭"></Toggle>
|
||||
</div>
|
||||
<div class="col-6 col-sm-6">
|
||||
<Toggle @bind-Value="AppInfo.OAuthLogin" OnText="启用" OffText="关闭"></Toggle>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 text-end">
|
||||
<Button ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="保存" />
|
||||
</div>
|
||||
</div>
|
||||
</ValidateForm>
|
||||
</AdminCard>
|
||||
|
||||
<AdminCard HeaderText="默认应用设置" AuthorizeKey="DefaultApp">
|
||||
<AdminAlert Text="开启本功能后登录成功时自动导航到第一个已授权前台应用" Color="Color.Info" />
|
||||
|
|
|
@ -54,6 +54,8 @@ public partial class Settings
|
|||
TitleSetting = DictService.GetAppTitle(),
|
||||
FixHeaderSetting = DictService.GetAppFixHeader(),
|
||||
HealthCheckSetting = DictService.GetAppHealthCheck(),
|
||||
MobileLogin = DictService.GetAppMobileLogin(),
|
||||
OAuthLogin = DictService.GetAppOAuthLogin()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -119,4 +121,11 @@ public partial class Settings
|
|||
DictService.SaveAppHealthCheck(AppInfo.HealthCheckSetting);
|
||||
await ShowToast(ret, "网站功能");
|
||||
}
|
||||
|
||||
private async Task OnSaveSaveAppLogin(EditContext context)
|
||||
{
|
||||
var ret = DictService.SaveAppMobileLogin(AppInfo.MobileLogin);
|
||||
DictService.SaveAppOAuthLogin(AppInfo.TitleSetting);
|
||||
await ShowToast(ret, "网站登录");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue