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
8c205b69
You need to sign in or sign up before continuing.
Commit
8c205b69
authored
Aug 23, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: site title check + UI fixes + 2FA setup on account verify
parent
f72530bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
12 deletions
+21
-12
admin-general.vue
client/components/admin/admin-general.vue
+12
-7
loader.vue
client/components/common/loader.vue
+1
-1
register.vue
client/components/register.vue
+1
-1
auth.js
server/controllers/auth.js
+7
-3
No files found.
client/components/admin/admin-general.vue
View file @
8c205b69
...
@@ -177,6 +177,8 @@ import editorStore from '../../store/editor'
...
@@ -177,6 +177,8 @@ import editorStore from '../../store/editor'
/* global WIKI */
/* global WIKI */
const
titleRegex
=
/
[
<>"
]
/i
WIKI
.
$store
.
registerModule
(
'editor'
,
editorStore
)
WIKI
.
$store
.
registerModule
(
'editor'
,
editorStore
)
export
default
{
export
default
{
...
@@ -186,12 +188,6 @@ export default {
...
@@ -186,12 +188,6 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
analyticsServices
:
[
{
text
:
'None'
,
value
:
''
},
{
text
:
'Elasticsearch APM RUM'
,
value
:
'elk'
},
{
text
:
'Google Analytics'
,
value
:
'ga'
},
{
text
:
'Google Tag Manager'
,
value
:
'gtm'
}
],
config
:
{
config
:
{
host
:
''
,
host
:
''
,
title
:
''
,
title
:
''
,
...
@@ -238,6 +234,15 @@ export default {
...
@@ -238,6 +234,15 @@ export default {
},
},
methods
:
{
methods
:
{
async
save
()
{
async
save
()
{
const
title
=
_
.
get
(
this
.
config
,
'title'
,
''
)
if
(
titleRegex
.
test
(
title
))
{
this
.
$store
.
commit
(
'showNotification'
,
{
style
:
'error'
,
message
:
this
.
$t
(
'admin:general.siteTitleInvalidChars'
),
icon
:
'alert'
})
return
}
try
{
try
{
await
this
.
$apollo
.
mutate
({
await
this
.
$apollo
.
mutate
({
mutation
:
gql
`
mutation
:
gql
`
...
@@ -300,7 +305,7 @@ export default {
...
@@ -300,7 +305,7 @@ export default {
})
})
this
.
$store
.
commit
(
'showNotification'
,
{
this
.
$store
.
commit
(
'showNotification'
,
{
style
:
'success'
,
style
:
'success'
,
message
:
'Configuration saved successfully.'
,
message
:
this
.
$t
(
'admin:general.saveSuccess'
)
,
icon
:
'check'
icon
:
'check'
})
})
this
.
siteTitle
=
this
.
config
.
title
this
.
siteTitle
=
this
.
config
.
title
...
...
client/components/common/loader.vue
View file @
8c205b69
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
:size='60'
:size='60'
color='#FFF'
color='#FFF'
)
)
img(v-else-if='mode === `icon`', :src='`/svg/icon-` + icon + `.svg`', :alt='icon')
img(v-else-if='mode === `icon`', :src='`/
_assets/
svg/icon-` + icon + `.svg`', :alt='icon')
.subtitle-1.white--text
{{
title
}}
.subtitle-1.white--text
{{
title
}}
.caption
{{
subtitle
}}
.caption
{{
subtitle
}}
</
template
>
</
template
>
...
...
client/components/register.vue
View file @
8c205b69
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
loader(v-model='isLoading', :mode='loaderMode', :icon='loaderIcon', :color='loaderColor', :title='loaderTitle', :subtitle='loaderSubtitle')
loader(v-model='isLoading', :mode='loaderMode', :icon='loaderIcon', :color='loaderColor', :title='loaderTitle', :subtitle='loaderSubtitle')
nav-footer(color='grey darken-5', dark-color='grey darken-5')
nav-footer(color='grey darken-5', dark-color='grey darken-5')
notify
notify
(style='padding-top: 64px;')
</
template
>
</
template
>
<
script
>
<
script
>
...
...
server/controllers/auth.js
View file @
8c205b69
...
@@ -135,10 +135,14 @@ router.get('/verify/:token', bruteforce.prevent, async (req, res, next) => {
...
@@ -135,10 +135,14 @@ router.get('/verify/:token', bruteforce.prevent, async (req, res, next) => {
try
{
try
{
const
usr
=
await
WIKI
.
models
.
userKeys
.
validateToken
({
kind
:
'verify'
,
token
:
req
.
params
.
token
})
const
usr
=
await
WIKI
.
models
.
userKeys
.
validateToken
({
kind
:
'verify'
,
token
:
req
.
params
.
token
})
await
WIKI
.
models
.
users
.
query
().
patch
({
isVerified
:
true
}).
where
(
'id'
,
usr
.
id
)
await
WIKI
.
models
.
users
.
query
().
patch
({
isVerified
:
true
}).
where
(
'id'
,
usr
.
id
)
const
result
=
await
WIKI
.
models
.
users
.
refreshToken
(
usr
)
req
.
brute
.
reset
()
req
.
brute
.
reset
()
res
.
cookie
(
'jwt'
,
result
.
token
,
{
expires
:
moment
().
add
(
1
,
'years'
).
toDate
()
})
if
(
WIKI
.
config
.
auth
.
enforce2FA
)
{
res
.
redirect
(
'/'
)
res
.
redirect
(
'/login'
)
}
else
{
const
result
=
await
WIKI
.
models
.
users
.
refreshToken
(
usr
)
res
.
cookie
(
'jwt'
,
result
.
token
,
{
expires
:
moment
().
add
(
1
,
'years'
).
toDate
()
})
res
.
redirect
(
'/'
)
}
}
catch
(
err
)
{
}
catch
(
err
)
{
next
(
err
)
next
(
err
)
}
}
...
...
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