mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 04:54:32 +08:00
安全设置中增加允许记住登录选项
This commit is contained in:
@@ -56,19 +56,26 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.Data["token"] = stringutil.Md5(TokenSalt+timestamp) + timestamp
|
||||
this.Data["from"] = params.From
|
||||
|
||||
config, err := configloaders.LoadAdminUIConfig()
|
||||
uiConfig, err := configloaders.LoadAdminUIConfig()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
this.Data["systemName"] = config.AdminSystemName
|
||||
this.Data["showVersion"] = config.ShowVersion
|
||||
if len(config.Version) > 0 {
|
||||
this.Data["version"] = config.Version
|
||||
this.Data["systemName"] = uiConfig.AdminSystemName
|
||||
this.Data["showVersion"] = uiConfig.ShowVersion
|
||||
if len(uiConfig.Version) > 0 {
|
||||
this.Data["version"] = uiConfig.Version
|
||||
} else {
|
||||
this.Data["version"] = teaconst.Version
|
||||
}
|
||||
this.Data["faviconFileId"] = config.FaviconFileId
|
||||
this.Data["faviconFileId"] = uiConfig.FaviconFileId
|
||||
|
||||
securityConfig, err := configloaders.LoadSecurityConfig()
|
||||
if err != nil {
|
||||
this.Data["rememberLogin"] = false
|
||||
} else {
|
||||
this.Data["rememberLogin"] = securityConfig.AllowRememberLogin
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
@@ -69,11 +69,12 @@ func (this *IndexAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunPost(params struct {
|
||||
Frame string
|
||||
CountryIdsJSON []byte
|
||||
ProvinceIdsJSON []byte
|
||||
AllowLocal bool
|
||||
AllowIPs []string
|
||||
Frame string
|
||||
CountryIdsJSON []byte
|
||||
ProvinceIdsJSON []byte
|
||||
AllowLocal bool
|
||||
AllowIPs []string
|
||||
AllowRememberLogin bool
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -127,6 +128,9 @@ func (this *IndexAction) RunPost(params struct {
|
||||
// 允许本地
|
||||
config.AllowLocal = params.AllowLocal
|
||||
|
||||
// 允许记住登录
|
||||
config.AllowRememberLogin = params.AllowRememberLogin
|
||||
|
||||
err = configloaders.UpdateSecurityConfig(config)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -47,10 +47,10 @@
|
||||
<input type="text" name="otpCode" placeholder="请输入OTP动态密码" maxlength="6"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<div class="ui field" v-if="rememberLogin">
|
||||
<a href="" @click.prevent="showMoreOptions()">更多选项 <i class="icon angle" :class="{down:!moreOptionsVisible, up:moreOptionsVisible}"></i> </a>
|
||||
</div>
|
||||
<div class="ui field" v-show="moreOptionsVisible">
|
||||
<div class="ui field" v-if="rememberLogin" v-show="moreOptionsVisible">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="remember" value="1" checked="checked"/>
|
||||
<label>在这个电脑上记住登录(14天)</label>
|
||||
|
||||
@@ -43,6 +43,13 @@
|
||||
<p class="comment">选中表示允许在本机和局域网访问。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>允许记住登录</td>
|
||||
<td>
|
||||
<checkbox name="allowRememberLogin" v-model="config.allowRememberLogin"></checkbox>
|
||||
<p class="comment">选中表示允许在登录界面可以选择记住登录。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
Reference in New Issue
Block a user