feat: hide login domain
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import app from '../hono/hono';
|
||||
import result from '../model/result';
|
||||
import settingService from '../service/setting-service';
|
||||
import userContext from "../security/user-context";
|
||||
|
||||
app.put('/setting/set', async (c) => {
|
||||
await settingService.set(c, await c.req.json());
|
||||
|
||||
@@ -12,8 +12,8 @@ const userContext = {
|
||||
|
||||
async getToken(c) {
|
||||
const jwt = c.req.header(constant.TOKEN_HEADER);
|
||||
const { token } = JwtUtils.verifyToken(c,jwt);
|
||||
return token;
|
||||
const result = await JwtUtils.verifyToken(c,jwt);
|
||||
return result?.token;
|
||||
},
|
||||
};
|
||||
export default userContext;
|
||||
|
||||
@@ -259,7 +259,6 @@ const accountService = {
|
||||
|
||||
async setAsTop(c, params, userId) {
|
||||
const { accountId } = params;
|
||||
console.log(accountId);
|
||||
const userRow = await userService.selectById(c, userId);
|
||||
const mainAccountRow = await accountService.selectByEmailIncludeDel(c, userRow.email);
|
||||
let mainSort = mainAccountRow.sort === 0 ? 2 : mainAccountRow.sort + 1;
|
||||
|
||||
@@ -165,7 +165,6 @@ const roleService = {
|
||||
const availIndex = availDomain.findIndex(item => {
|
||||
const domain = emailUtils.getDomain(email.toLowerCase());
|
||||
const availDomainItem = item.toLowerCase();
|
||||
console.log(domain,availDomainItem)
|
||||
return domain === availDomainItem
|
||||
})
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import constant from '../const/constant';
|
||||
import BizError from '../error/biz-error';
|
||||
import {t} from '../i18n/i18n'
|
||||
import verifyRecordService from './verify-record-service';
|
||||
import userContext from '../security/user-context';
|
||||
|
||||
const settingService = {
|
||||
|
||||
@@ -59,8 +60,6 @@ const settingService = {
|
||||
linuxdoSwitch = false
|
||||
}
|
||||
|
||||
console.log(projectLink)
|
||||
|
||||
if (typeof projectLink === 'string' && projectLink === 'false') {
|
||||
projectLink = false
|
||||
} else if (projectLink === false) {
|
||||
@@ -195,6 +194,7 @@ const settingService = {
|
||||
async websiteConfig(c) {
|
||||
|
||||
const settingRow = await this.get(c, true);
|
||||
const token = await userContext.getToken(c);
|
||||
|
||||
return {
|
||||
register: settingRow.register,
|
||||
@@ -209,7 +209,7 @@ const settingService = {
|
||||
siteKey: settingRow.siteKey,
|
||||
background: settingRow.background,
|
||||
loginOpacity: settingRow.loginOpacity,
|
||||
domainList: settingRow.domainList,
|
||||
domainList: settingRow.loginDomain === 1 && !token ? [] : settingRow.domainList,
|
||||
regKey: settingRow.regKey,
|
||||
regVerifyOpen: settingRow.regVerifyOpen,
|
||||
addVerifyOpen: settingRow.addVerifyOpen,
|
||||
|
||||
Reference in New Issue
Block a user