mirror of
https://github.com/requarks/wiki.git
synced 2025-02-25 18:55:30 -06:00
Merge bfc4ade6c3
into 403e98dced
This commit is contained in:
commit
17ec95d406
@ -187,6 +187,15 @@
|
||||
persistent-hint
|
||||
:hint='$t(`admin:security.bypassLoginHint`)'
|
||||
)
|
||||
v-switch(
|
||||
inset
|
||||
:label='$t(`admin:security.bypassUnauthorized`)'
|
||||
color='primary'
|
||||
v-model='config.authBypassUnauthorized'
|
||||
prepend-icon='mdi-fast-forward'
|
||||
persistent-hint
|
||||
:hint='$t(`admin:security.bypassUnauthorizedHint`)'
|
||||
)
|
||||
v-switch(
|
||||
inset
|
||||
:label='$t(`admin:security.hideLocalLogin`)'
|
||||
@ -272,6 +281,7 @@ export default {
|
||||
securityCSP: false,
|
||||
securityCSPDirectives: '',
|
||||
authAutoLogin: false,
|
||||
authBypassUnauthorized: false,
|
||||
authHideLocal: false,
|
||||
authLoginBgUrl: '',
|
||||
authJwtAudience: 'urn:wiki.js',
|
||||
@ -298,6 +308,7 @@ export default {
|
||||
mutation: gql`
|
||||
mutation (
|
||||
$authAutoLogin: Boolean
|
||||
$authBypassUnauthorized: Boolean
|
||||
$authEnforce2FA: Boolean
|
||||
$authHideLocal: Boolean
|
||||
$authLoginBgUrl: String
|
||||
@ -321,6 +332,7 @@ export default {
|
||||
site {
|
||||
updateConfig(
|
||||
authAutoLogin: $authAutoLogin,
|
||||
authBypassUnauthorized: $authBypassUnauthorized,
|
||||
authEnforce2FA: $authEnforce2FA,
|
||||
authHideLocal: $authHideLocal,
|
||||
authLoginBgUrl: $authLoginBgUrl,
|
||||
@ -353,6 +365,7 @@ export default {
|
||||
`,
|
||||
variables: {
|
||||
authAutoLogin: _.get(this.config, 'authAutoLogin', false),
|
||||
authBypassUnauthorized: _.get(this.config, 'authBypassUnauthorized', false),
|
||||
authEnforce2FA: _.get(this.config, 'authEnforce2FA', false),
|
||||
authHideLocal: _.get(this.config, 'authHideLocal', false),
|
||||
authLoginBgUrl: _.get(this.config, 'authLoginBgUrl', ''),
|
||||
@ -406,6 +419,7 @@ export default {
|
||||
site {
|
||||
config {
|
||||
authAutoLogin
|
||||
authBypassUnauthorized
|
||||
authEnforce2FA
|
||||
authHideLocal
|
||||
authLoginBgUrl
|
||||
|
@ -63,6 +63,7 @@ defaults:
|
||||
tocPosition: 'left'
|
||||
auth:
|
||||
autoLogin: false
|
||||
bypassUnauthorized: false
|
||||
enforce2FA: false
|
||||
hideLocal: false
|
||||
loginBgUrl: ''
|
||||
|
@ -447,7 +447,11 @@ router.get('/*', async (req, res, next) => {
|
||||
maxAge: 15 * 60 * 1000
|
||||
})
|
||||
}
|
||||
if (pageArgs.path === 'home' && req.user.id === 2) {
|
||||
|
||||
// If the user is the guest user (id 2) and either trying to access the home page for the wiki
|
||||
// or the wiki is configured to not show unauthorized for the guest user,
|
||||
// redirect to the login page for the wiki.
|
||||
if ((pageArgs.path === 'home' || WIKI.config.auth.bypassUnauthorized) && req.user.id === 2) {
|
||||
return res.redirect('/login')
|
||||
}
|
||||
_.set(res.locals, 'pageMeta.title', 'Unauthorized')
|
||||
|
@ -25,6 +25,7 @@ module.exports = {
|
||||
...WIKI.config.features,
|
||||
...WIKI.config.security,
|
||||
authAutoLogin: WIKI.config.auth.autoLogin,
|
||||
authBypassUnauthorized: WIKI.config.auth.bypassUnauthorized,
|
||||
authEnforce2FA: WIKI.config.auth.enforce2FA,
|
||||
authHideLocal: WIKI.config.auth.hideLocal,
|
||||
authLoginBgUrl: WIKI.config.auth.loginBgUrl,
|
||||
@ -82,6 +83,7 @@ module.exports = {
|
||||
|
||||
WIKI.config.auth = {
|
||||
autoLogin: _.get(args, 'authAutoLogin', WIKI.config.auth.autoLogin),
|
||||
bypassUnauthorized: _.get(args, 'authBypassUnauthorized', WIKI.config.auth.bypassUnauthorized),
|
||||
enforce2FA: _.get(args, 'authEnforce2FA', WIKI.config.auth.enforce2FA),
|
||||
hideLocal: _.get(args, 'authHideLocal', WIKI.config.auth.hideLocal),
|
||||
loginBgUrl: _.get(args, 'authLoginBgUrl', WIKI.config.auth.loginBgUrl),
|
||||
|
@ -36,6 +36,7 @@ type SiteMutation {
|
||||
logoUrl: String
|
||||
pageExtensions: String
|
||||
authAutoLogin: Boolean
|
||||
authBypassUnauthorized: Boolean
|
||||
authEnforce2FA: Boolean
|
||||
authHideLocal: Boolean
|
||||
authLoginBgUrl: String
|
||||
@ -86,6 +87,7 @@ type SiteConfig {
|
||||
logoUrl: String
|
||||
pageExtensions: String
|
||||
authAutoLogin: Boolean
|
||||
authBypassUnauthorized: Boolean
|
||||
authEnforce2FA: Boolean
|
||||
authHideLocal: Boolean
|
||||
authLoginBgUrl: String
|
||||
|
Loading…
Reference in New Issue
Block a user