Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
b4757955
Commit
b4757955
authored
Jul 05, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: login bg + bypass + hide local option
parent
5282a82a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
7 deletions
+50
-7
admin-security.vue
client/components/admin/admin-security.vue
+15
-1
login.vue
client/components/login.vue
+13
-2
data.yml
server/app/data.yml
+1
-0
auth.js
server/controllers/auth.js
+11
-1
site.js
server/graph/resolvers/site.js
+2
-0
site.graphql
server/graph/schemas/site.graphql
+2
-0
authentication.js
server/models/authentication.js
+2
-2
login.pug
server/views/login.pug
+4
-1
No files found.
client/components/admin/admin-security.vue
View file @
b4757955
...
...
@@ -163,12 +163,21 @@
v-switch(
inset
:label='$t(`admin:security.bypassLogin`)'
color='
red darken-2
'
color='
primary
'
v-model='config.authAutoLogin'
prepend-icon='mdi-fast-forward'
persistent-hint
:hint='$t(`admin:security.bypassLoginHint`)'
)
v-switch(
inset
:label='$t(`admin:security.hideLocalLogin`)'
color='primary'
v-model='config.authHideLocal'
prepend-icon='mdi-eye-off-outline'
persistent-hint
:hint='$t(`admin:security.hideLocalLoginHint`)'
)
v-divider.mt-3
.overline.grey--text.pa-4
{{
$t
(
'admin:security.jwt'
)
}}
.px-4.pb-3
...
...
@@ -231,6 +240,7 @@ export default {
securityCSP
:
false
,
securityCSPDirectives
:
''
,
authAutoLogin
:
false
,
authHideLocal
:
false
,
authLoginBgUrl
:
''
,
authJwtAudience
:
'urn:wiki.js'
,
authJwtExpiration
:
'30m'
,
...
...
@@ -256,6 +266,7 @@ export default {
mutation
:
gql
`
mutation (
$authAutoLogin: Boolean
$authHideLocal: Boolean
$authLoginBgUrl: String
$authJwtAudience: String
$authJwtExpiration: String
...
...
@@ -275,6 +286,7 @@ export default {
site {
updateConfig(
authAutoLogin: $authAutoLogin,
authHideLocal: $authHideLocal,
authLoginBgUrl: $authLoginBgUrl,
authJwtAudience: $authJwtAudience,
authJwtExpiration: $authJwtExpiration,
...
...
@@ -303,6 +315,7 @@ export default {
`
,
variables
:
{
authAutoLogin
:
_
.
get
(
this
.
config
,
'authAutoLogin'
,
false
),
authHideLocal
:
_
.
get
(
this
.
config
,
'authHideLocal'
,
false
),
authLoginBgUrl
:
_
.
get
(
this
.
config
,
'authLoginBgUrl'
,
''
),
authJwtAudience
:
_
.
get
(
this
.
config
,
'authJwtAudience'
,
''
),
authJwtExpiration
:
_
.
get
(
this
.
config
,
'authJwtExpiration'
,
''
),
...
...
@@ -352,6 +365,7 @@ export default {
site {
config {
authAutoLogin
authHideLocal
authLoginBgUrl
authJwtAudience
authJwtExpiration
...
...
client/components/login.vue
View file @
b4757955
<
template
lang=
"pug"
>
v-app
.login
.login
(:style='`background-image: url(` + bgUrl + `);`')
.login-sd
.d-flex
.login-logo
...
...
@@ -238,6 +238,16 @@ import { sync } from 'vuex-pathify'
export
default
{
i18nOptions
:
{
namespaces
:
'auth'
}
,
props
:
{
bgUrl
:
{
type
:
String
,
default
:
''
}
,
hideLocal
:
{
type
:
Boolean
,
default
:
false
}
}
,
data
()
{
return
{
error
:
false
,
...
...
@@ -535,7 +545,8 @@ export default {
<
style
lang
=
"scss"
>
.
login
{
background
-
image
:
url
(
'/_assets/img/splash/1.jpg'
);
// background-image: url('/_assets/img/splash/1.jpg');
background
-
color
:
mc
(
'grey'
,
'900'
);
background
-
size
:
cover
;
background
-
position
:
center
center
;
width
:
100
%
;
...
...
server/app/data.yml
View file @
b4757955
...
...
@@ -55,6 +55,7 @@ defaults:
darkMode
:
false
auth
:
autoLogin
:
false
hideLocal
:
false
loginBgUrl
:
'
'
audience
:
'
urn:wiki.js'
tokenExpiration
:
'
30m'
...
...
server/controllers/auth.js
View file @
b4757955
...
...
@@ -33,7 +33,17 @@ router.get('/login', async (req, res, next) => {
socialStrategies
})
}
else
{
res
.
render
(
'login'
)
// -> Bypass Login
if
(
WIKI
.
config
.
auth
.
autoLogin
&&
!
req
.
query
.
all
)
{
const
stg
=
await
WIKI
.
models
.
authentication
.
query
().
orderBy
(
'order'
).
first
()
const
stgInfo
=
_
.
find
(
WIKI
.
data
.
authentication
,
[
'key'
,
stg
.
strategyKey
])
if
(
!
stgInfo
.
useForm
)
{
return
res
.
redirect
(
`/login/
${
stg
.
key
}
`
)
}
}
// -> Show Login
const
bgUrl
=
!
_
.
isEmpty
(
WIKI
.
config
.
auth
.
loginBgUrl
)
?
WIKI
.
config
.
auth
.
loginBgUrl
:
'/_assets/img/splash/1.jpg'
res
.
render
(
'login'
,
{
bgUrl
,
hideLocal
:
WIKI
.
config
.
auth
.
hideLocal
})
}
})
...
...
server/graph/resolvers/site.js
View file @
b4757955
...
...
@@ -22,6 +22,7 @@ module.exports = {
...
WIKI
.
config
.
features
,
...
WIKI
.
config
.
security
,
authAutoLogin
:
WIKI
.
config
.
auth
.
autoLogin
,
authHideLocal
:
WIKI
.
config
.
auth
.
hideLocal
,
authLoginBgUrl
:
WIKI
.
config
.
auth
.
loginBgUrl
,
authJwtAudience
:
WIKI
.
config
.
auth
.
audience
,
authJwtExpiration
:
WIKI
.
config
.
auth
.
tokenExpiration
,
...
...
@@ -67,6 +68,7 @@ module.exports = {
WIKI
.
config
.
auth
=
{
autoLogin
:
_
.
get
(
args
,
'authAutoLogin'
,
WIKI
.
config
.
auth
.
autoLogin
),
hideLocal
:
_
.
get
(
args
,
'authHideLocal'
,
WIKI
.
config
.
auth
.
hideLocal
),
loginBgUrl
:
_
.
get
(
args
,
'authLoginBgUrl'
,
WIKI
.
config
.
auth
.
loginBgUrl
),
audience
:
_
.
get
(
args
,
'authJwtAudience'
,
WIKI
.
config
.
auth
.
audience
),
tokenExpiration
:
_
.
get
(
args
,
'authJwtExpiration'
,
WIKI
.
config
.
auth
.
tokenExpiration
),
...
...
server/graph/schemas/site.graphql
View file @
b4757955
...
...
@@ -34,6 +34,7 @@ type SiteMutation {
contentLicense
:
String
logoUrl
:
String
authAutoLogin
:
Boolean
authHideLocal
:
Boolean
authLoginBgUrl
:
String
authJwtAudience
:
String
authJwtExpiration
:
String
...
...
@@ -71,6 +72,7 @@ type SiteConfig {
contentLicense
:
String
!
logoUrl
:
String
!
authAutoLogin
:
Boolean
authHideLocal
:
Boolean
authLoginBgUrl
:
String
authJwtAudience
:
String
authJwtExpiration
:
String
...
...
server/models/authentication.js
View file @
b4757955
...
...
@@ -36,11 +36,11 @@ module.exports = class Authentication extends Model {
static
async
getStrategies
()
{
const
strategies
=
await
WIKI
.
models
.
authentication
.
query
().
orderBy
(
'order'
)
return
_
.
sortBy
(
strategies
.
map
(
str
=>
({
return
strategies
.
map
(
str
=>
({
...
str
,
domainWhitelist
:
_
.
get
(
str
.
domainWhitelist
,
'v'
,
[]),
autoEnrollGroups
:
_
.
get
(
str
.
autoEnrollGroups
,
'v'
,
[])
}))
,
[
'key'
])
}))
}
static
async
getStrategiesForLegacyClient
()
{
...
...
server/views/login.pug
View file @
b4757955
...
...
@@ -2,4 +2,7 @@ extends master.pug
block body
#root.is-fullscreen
login
login(
bg-url=bgUrl
hide-local=hideLocal
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment