refactor: 保存浏览器上的 origin 作为当前站点
This commit is contained in:
parent
dffc1b6c2a
commit
cb6179e1fc
|
@ -1,5 +1,7 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
public interface ExtSystemParameterMapper {
|
||||
String email();
|
||||
String email();
|
||||
|
||||
void saveBaseurl(String baseurl);
|
||||
}
|
||||
|
|
|
@ -5,4 +5,9 @@
|
|||
<select id="email" resultType="string">
|
||||
select param_value from system_parameter where param_key=#{smtp.account}
|
||||
</select>
|
||||
|
||||
<update id="saveBaseurl">
|
||||
update system_parameter set param_value = #{baseurl,jdbcType=VARCHAR}
|
||||
where param_key = 'base.url' and (param_value like 'http://localhost%' or param_value = '' or param_value is null)
|
||||
</update>
|
||||
</mapper>
|
|
@ -47,6 +47,7 @@ public class ShiroUtils {
|
|||
filterChainDefinitionMap.put("/api/document/**", "anon");
|
||||
filterChainDefinitionMap.put("/document/**", "anon");
|
||||
filterChainDefinitionMap.put("/system/theme", "anon");
|
||||
filterChainDefinitionMap.put("/system/save/baseurl/**", "anon");
|
||||
|
||||
filterChainDefinitionMap.put("/v1/catalog/**", "anon");
|
||||
filterChainDefinitionMap.put("/v1/agent/**", "anon");
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SystemParameterController {
|
|||
private SystemParameterService SystemParameterService;
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置",beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class)
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置", beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class)
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.editMail(systemParameter);
|
||||
}
|
||||
|
@ -65,6 +65,11 @@ public class SystemParameterController {
|
|||
SystemParameterService.saveBaseInfo(systemParameter);
|
||||
}
|
||||
|
||||
@GetMapping("/save/baseurl")
|
||||
public void saveBaseurl(@RequestParam("baseurl") String baseurl) {
|
||||
SystemParameterService.saveBaseurl(baseurl);
|
||||
}
|
||||
|
||||
@PostMapping("/save/ldap")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails()", content = "#msClass.getLogDetails()", msClass = SystemParameterService.class)
|
||||
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
|
||||
|
|
|
@ -328,4 +328,7 @@ public class SystemParameterService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void saveBaseurl(String baseurl) {
|
||||
extSystemParameterMapper.saveBaseurl(baseurl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
<el-radio-group v-model="form.authenticate" @change="redirectAuth(form.authenticate)">
|
||||
<el-radio label="LDAP" size="mini" v-if="openLdap">LDAP</el-radio>
|
||||
<el-radio label="LOCAL" size="mini" v-if="openLdap">普通登录</el-radio>
|
||||
<el-radio :label="auth.id" size="mini" v-for="auth in authSources" :key="auth.id">{{ auth.type }} {{ auth.name }}</el-radio>
|
||||
<el-radio :label="auth.id" size="mini" v-for="auth in authSources" :key="auth.id">{{ auth.type }}
|
||||
{{ auth.name }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username">
|
||||
|
@ -88,13 +90,20 @@ export default {
|
|||
loginTitle: this.$t("commons.welcome"),
|
||||
authSources: [],
|
||||
loginUrl: 'signin',
|
||||
}
|
||||
};
|
||||
},
|
||||
beforeCreate() {
|
||||
this.$get('/system/theme', res => {
|
||||
this.color = res.data ? res.data : PRIMARY_COLOR;
|
||||
document.body.style.setProperty('--primary_color', this.color);
|
||||
})
|
||||
});
|
||||
// 保存当前站点url
|
||||
this.$get('/system/save/baseurl?baseurl=' + window.location.origin)
|
||||
.then(() => {
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
|
||||
this.result = this.$get("/isLogin").then(response => {
|
||||
|
||||
if (display.default !== undefined) {
|
||||
|
@ -118,17 +127,17 @@ export default {
|
|||
});
|
||||
this.$get("/ldap/open", response => {
|
||||
this.openLdap = response.data;
|
||||
if (this.openLdap){
|
||||
if (this.openLdap) {
|
||||
this.form.authenticate = 'LDAP';
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
created: function () {
|
||||
// 主页添加键盘事件,注意,不能直接在焦点事件上添加回车
|
||||
document.addEventListener("keydown", this.watchEnter);
|
||||
//
|
||||
if (license.default) {
|
||||
license.default.valid(this)
|
||||
license.default.valid(this);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -187,10 +196,10 @@ export default {
|
|||
this.$get("language", response => {
|
||||
language = response.data;
|
||||
localStorage.setItem(DEFAULT_LANGUAGE, language);
|
||||
window.location.href = "/"
|
||||
})
|
||||
window.location.href = "/";
|
||||
});
|
||||
} else {
|
||||
window.location.href = "/"
|
||||
window.location.href = "/";
|
||||
}
|
||||
},
|
||||
redirectAuth(authId) {
|
||||
|
@ -199,7 +208,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue