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