feat: beta preparation + utf16 editor fix

pull/760/head
Nicolas Giard 6 years ago
parent 4bee20e664
commit 3b285c5074

@ -8,12 +8,12 @@
.headline.blue--text.text--darken-2 API
.subheading.grey--text Manage keys to access the API
v-spacer
v-btn(outline, color='grey', large)
v-btn(outline, color='grey', large, @click='refresh')
v-icon refresh
v-btn(color='green', dark, depressed, large)
v-btn(color='green', dark, depressed, large, @click='globalSwitch')
v-icon(left) power_settings_new
| Enable API
v-btn(color='primary', depressed, large)
v-btn(color='primary', depressed, large, @click='newKey')
v-icon(left) add
| New API Key
v-card.mt-3
@ -104,6 +104,27 @@ export default {
} else {
this.selected = this.items.slice()
}
},
async refresh() {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
async globalSwitch() {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
async newKey() {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
}
}
}

@ -10,9 +10,9 @@
v-spacer
v-btn(outline, color='grey', @click='refresh', large)
v-icon refresh
v-btn(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-card.mt-3
v-tabs(color='grey darken-2', fixed-tabs, slider-color='white', show-arrows, dark)
@ -26,13 +26,14 @@
.body-2.grey--text.text--darken-1 Select which authentication strategies to enable:
.caption.grey--text.pb-2 Some strategies require additional configuration in their dedicated tab (when selected).
v-form
//- TODO - Prevent crash on unfinished strategies
v-checkbox.my-0(
v-for='strategy in strategies'
v-model='strategy.isEnabled'
:key='strategy.key'
:label='strategy.title'
color='primary'
:disabled='strategy.key === `local`'
:disabled='strategy.key === `local` || true'
hide-details
)
v-flex(xs12, md6)

@ -8,53 +8,38 @@
.headline.primary--text {{ $t('admin:dashboard.title') }}
.subheading.grey--text {{ $t('admin:dashboard.subtitle') }}
v-flex(xs12 md6 lg4 xl3 d-flex)
v-hover
v-card.primary.dashboard-card(
dark
slot-scope='{ hover }'
:class='hover ? `elevation-10` : `elevation-2`'
)
v-card-text
v-icon.dashboard-icon insert_drive_file
.subheading Pages
animated-number.display-1(
:value='info.pagesTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-card.primary.dashboard-card(dark)
v-card-text
v-icon.dashboard-icon insert_drive_file
.subheading Pages
animated-number.display-1(
:value='info.pagesTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
v-hover
v-card.indigo.lighten-1.dashboard-card(
dark
slot-scope='{ hover }'
:class='hover ? `elevation-10` : `elevation-2`'
)
v-card-text
v-icon.dashboard-icon person
.subheading Users
animated-number.display-1(
:value='info.usersTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-card.indigo.lighten-1.dashboard-card(dark)
v-card-text
v-icon.dashboard-icon person
.subheading Users
animated-number.display-1(
:value='info.usersTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
v-hover
v-card.indigo.lighten-2.dashboard-card(
dark
slot-scope='{ hover }'
:class='hover ? `elevation-10` : `elevation-2`'
)
v-card-text
v-icon.dashboard-icon people
.subheading Groups
animated-number.display-1(
:value='info.groupsTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-card.indigo.lighten-2.dashboard-card(dark)
v-card-text
v-icon.dashboard-icon people
.subheading Groups
animated-number.display-1(
:value='info.groupsTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg12 xl3 d-flex)
v-card.dashboard-card(
:class='isLatestVersion ? "teal lighten-2" : "red lighten-2"'
@ -65,7 +50,7 @@
v-icon(v-else, color='red darken-4') get_app
v-card-text
v-icon.dashboard-icon blur_on
.subheading Wiki.js {{info.currentVersion}}
.subheading Wiki.js {{info.currentVersion}} BETA
.body-2(v-if='isLatestVersion') You are running the latest version.
.body-2(v-else) A new version is available: {{info.latestVersion}}
v-flex(xs12)

@ -16,7 +16,7 @@
slider-color='white'
show-arrows
dark
@input='tabChanged'
@change='tabChanged'
)
v-tab(key='0') Graph API Playground
v-tab(key='1') Graph API Map
@ -67,7 +67,7 @@ let graphiQLInstance
export default {
data() {
return {
selectedTab: '0'
selectedTab: 0
}
},
mounted() {
@ -76,7 +76,7 @@ export default {
methods: {
tabChanged (tabId) {
switch (tabId) {
case '1':
case 1:
this.renderVoyager()
break
}

@ -6,13 +6,13 @@
img(src='/svg/icon-web-design.svg', alt='Editor', style='width: 80px;')
.admin-header-title
.headline.primary--text Editor
.subheading.grey--text Configure the content editor
.subheading.grey--text Configure the content editors
v-spacer
v-btn(outline, color='grey', @click='refresh', large)
v-icon refresh
v-btn(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-card.mt-3
v-tabs(color='grey darken-2', fixed-tabs, slider-color='white', show-arrows, dark)
@ -24,8 +24,15 @@
.body-2.grey--text.text--darken-1 Select which editors to enable:
.caption.grey--text.pb-2 Some editors require additional configuration in their dedicated tab (when selected).
v-form
v-radio-group(v-model='selectedEditor')
v-radio(v-for='(editor, n) in editors', :key='n', :label='editor.text', :value='editor.value', color='primary')
v-checkbox.my-0(
v-for='editor in editors'
v-model='editor.isEnabled'
:key='editor.key'
:label='editor.title'
color='primary'
disabled
hide-details
)
v-tab-item(key='code', :transition='false', :reverse-transition='false')
v-card.wiki-form.pa-3(flat, tile)
v-form
@ -38,9 +45,13 @@ export default {
data() {
return {
editors: [
{ text: 'Markdown (default)', value: 'code' }
],
selectedEditor: 'code'
{ title: 'API Docs', key: 'api', isEnabled: false },
{ title: 'Code', key: 'code', isEnabled: true },
{ title: 'Markdown', key: 'markdown', isEnabled: true },
{ title: 'Tabular', key: 'tabular', isEnabled: false },
{ title: 'Visual Builder', key: 'visual', isEnabled: false },
{ title: 'WikiText', key: 'wikitext', isEnabled: false }
]
}
},
methods: {

@ -77,6 +77,8 @@
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title
.subheading {{ $t('admin:general.siteBranding') }}
v-spacer
v-chip(label, color='white', small).primary--text coming soon
v-subheader Logo
v-card-text
v-layout.px-3(row, align-center)

@ -25,6 +25,7 @@
label='Group Name'
counter='255'
@keyup.enter='createGroup'
@keyup.esc='newGroupDialog = false'
ref='groupNameIpt'
)
v-card-chin

@ -13,9 +13,9 @@
v-btn(color='black', dark, depressed, @click='toggleConsole', large)
ConsoleLineIcon.mr-3
span Live Trail
v-btn.mr-0(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-card.mt-3
v-tabs(color='grey darken-2', fixed-tabs, slider-color='white', show-arrows, dark)

@ -10,9 +10,9 @@
v-spacer
v-btn(outline, color='grey', @click='refresh', large)
v-icon refresh
v-btn(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-flex(lg3, xs12)
v-toolbar(
@ -155,6 +155,20 @@ export default {
this.currentRenderer = _.find(rdr.children, ['key', key])
}
})
},
async refresh () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
async save () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
}
},
apollo: {

@ -10,12 +10,12 @@
v-spacer
v-btn(outline, color='grey', @click='refresh', large)
v-icon refresh
v-btn(color='black', dark, large, depressed)
v-btn(color='black', dark, large, depressed, @click='rebuild')
v-icon(left) cached
span Rebuild Index
v-btn(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-card.mt-3
v-tabs(color='grey darken-2', fixed-tabs, slider-color='white', show-arrows, dark)
@ -137,11 +137,18 @@ export default {
}
})
this.$store.commit('showNotification', {
message: 'Logging configuration saved successfully.',
message: 'Search engine configuration saved successfully.',
style: 'success',
icon: 'check'
})
this.$store.commit(`loadingStop`, 'admin-search-saveengines')
},
async rebuild () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
}
},
apollo: {

@ -10,9 +10,9 @@
v-spacer
v-btn(outline, color='grey', @click='refresh', large)
v-icon refresh
v-btn(color='primary', @click='save', depressed, large)
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='success', @click='save', depressed, large)
v-icon(left) check
span {{$t('common:actions.apply')}}
v-card.mt-3
v-tabs(color='grey darken-2', fixed-tabs, slider-color='white', show-arrows, dark)

@ -47,6 +47,8 @@
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title
.subheading Code Injection
v-spacer
v-chip(label, color='white', small).primary--text coming soon
v-card-text
v-textarea(
v-model='injectCSS'
@ -57,6 +59,7 @@
persistent-hint
hint='CSS code to inject after system default CSS'
auto-grow
disabled
)
v-textarea.mt-2(
v-model='injectHeader'
@ -67,6 +70,7 @@
persistent-hint
hint='HTML code to be injected just before the closing head tag'
auto-grow
disabled
)
v-textarea.mt-2(
v-model='injectFooter'
@ -77,12 +81,15 @@
persistent-hint
hint='HTML code to be injected just before the closing body tag'
auto-grow
disabled
)
v-flex(lg6 xs12)
v-card
v-toolbar(color='teal', dark, dense, flat)
v-toolbar-title
.subheading Download Themes
v-spacer
v-chip(label, color='white', small).teal--text coming soon
v-card-text.caption -- Coming soon --
</template>

@ -1,62 +1,44 @@
<template lang="pug">
v-dialog(v-model='isShown', max-width='550')
v-card
.dialog-header.is-short Authorize Social User
v-card.wiki-form
.dialog-header.is-short
span Authorize Social User
v-spacer
v-chip(label, color='white', small).primary--text coming soon
v-card-text
v-alert.mb-4.deep-orange.lighten-5.radius-7(
v-if='providers.length < 1'
color='deep-orange'
icon='warning'
outline
:value='true'
) You must enable at least 1 social strategy first.
v-select.md2(
:items='providers'
item-text='title'
item-value='key'
solo
flat
background-color='grey lighten-4'
outline
prepend-icon='business'
v-model='provider'
label='Provider'
)
v-text-field.md2(
solo
flat
background-color='grey lighten-4'
outline
prepend-icon='email'
v-model='email'
label='Email Address'
ref='emailInput'
)
v-text-field.md2(
solo
flat
background-color='grey lighten-4'
outline
prepend-icon='person'
v-model='name'
label='Name'
)
v-text-field.md2(
solo
flat
background-color='grey lighten-4'
prepend-icon='title'
v-model='jobTitle'
label='Job Title'
counter='255'
hint='Optional'
persistent-hint
)
v-text-field.md2(
solo
flat
background-color='grey lighten-4'
prepend-icon='public'
v-model='location'
label='Location'
counter='255'
hint='Optional'
persistent-hint
)
v-card-chin
v-spacer
v-btn(flat, @click='isShown = false') Cancel
v-btn(color='primary', @click='authorizeUser') Authorize
v-btn(color='primary', @click='authorizeUser', :disabled='providers.length < 1 || true') Authorize
</template>
<script>
@ -76,9 +58,7 @@ export default {
providers: [],
provider: '',
email: '',
name: '',
jobTitle: '',
location: ''
name: ''
}
},
computed: {

@ -10,7 +10,7 @@
v-spacer
.caption.grey--text ID #[strong {{user.id}}]
v-divider.mx-3(vertical)
v-btn(color='indigo', large, outline, to='/users')
v-btn(color='grey', large, outline, to='/users')
v-icon arrow_back
v-dialog(v-model='deleteUserDialog', max-width='500', v-if='user.id !== currentUserId && !user.isSystem')
v-btn(color='red', large, outline, slot='activator')

@ -10,7 +10,7 @@
v-spacer
v-btn(outline, color='grey', large, @click='refresh')
v-icon refresh
v-btn(color='primary', large, depressed, @click='authorizeUser')
v-btn(color='primary', large, outline, @click='authorizeUser')
v-icon(left) lock_outline
span Authorize Social User
v-btn(color='primary', large, depressed, @click='createUser')

@ -23,6 +23,8 @@
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
v-toolbar-title
.subheading Authentication
v-spacer
v-chip(label, color='white', small).grey--text.text--darken-2 coming soon
v-subheader Flush User Sessions
v-card-text.pt-0.pl-4
.body-1 This will cause all users to be logged out. You will need to log back in after the operation.
@ -40,6 +42,8 @@
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
v-toolbar-title
.subheading Modules
v-spacer
v-chip(label, color='white', small).grey--text.text--darken-2 coming soon
v-subheader Rescan Modules
v-card-text.pt-0.pl-4
.body-1 Look for new modules on disk. Existing configurations will be merged.
@ -60,6 +64,8 @@
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
v-toolbar-title
.subheading Maintenance Mode
v-spacer
v-chip(label, color='white', small).grey--text.text--darken-2 coming soon
v-card-text
.body-1 Maintenance mode restrict access to the site to administrators only, regarless of current permissions.
v-btn.mt-3.ml-0(color='orange darken-2', depressed, dark)
@ -69,6 +75,8 @@
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
v-toolbar-title
.subheading Graph Endpoint
v-spacer
v-chip(label, color='white', small).grey--text.text--darken-2 coming soon
v-card-text
.body-1 The Graph API Endpoint from which remote resources like locales, themes and plugins are fetched.
.caption.red--text Do not change unless you know what you're doing!
@ -77,6 +85,10 @@
v-icon(left) chevron_right
span Save
v-tab-item(key='cache', :transition='false', :reverse-transition='false')
v-card
v-card-text Coming soon
v-tab-item(key='telemetry', :transition='false', :reverse-transition='false')
v-card
v-form
@ -115,11 +127,11 @@
.subheading.mt-3.grey--text.text--darken-1 Client ID
.body-1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
v-card-chin
v-btn(color='primary')
v-btn(color='primary', @click='updateTelemetry')
v-icon(left) chevron_right
| Save Changes
v-spacer
v-btn(outline, color='grey')
v-btn(outline, color='grey', @click='resetClientId')
v-icon(left) autorenew
span Reset Client ID
@ -170,8 +182,19 @@ export default {
}
},
methods: {
resetClientID() {
updateTelemetry() {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
resetClientId() {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
}
}
}

@ -52,7 +52,7 @@
v-list-tile-content Delete
v-divider.my-0
v-subheader Assets
v-list-tile(avatar, @click='')
v-list-tile(avatar, @click='assets')
v-list-tile-avatar: v-icon(color='blue-grey') burst_mode
v-list-tile-content Images &amp; Files
v-toolbar-title(:class='{ "ml-2": $vuetify.breakpoint.mdAndUp, "ml-0": $vuetify.breakpoint.smAndDown }')
@ -230,10 +230,25 @@ export default {
window.location.assign(`/s/${this.path}`)
},
pageMove () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
pageDelete () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
assets () {
this.$store.commit('showNotification', {
style: 'indigo',
message: `Coming soon...`,
icon: 'directions_boat'
})
},
logout () {
Cookies.remove('jwt')

@ -36,7 +36,7 @@
.subheading Which editor do you want to use for this page?
v-container(grid-list-lg, fluid)
v-layout(row, wrap, justify-center)
v-flex(xs3)
v-flex(xs4)
v-card.radius-7.grey(
hover
light
@ -46,7 +46,7 @@
img(src='/svg/icon-rest-api.svg', alt='API', style='width: 36px;')
.body-2.mt-2.grey--text.text--darken-2 API Docs
.caption.grey--text.text--darken-1 REST / GraphQL
v-flex(xs3)
v-flex(xs4)
v-card.radius-7(
hover
light
@ -56,7 +56,7 @@
img(src='/svg/icon-source-code.svg', alt='Code', style='width: 36px;')
.body-2.mt-2 Code
.caption.grey--text Raw HTML
v-flex(xs3)
v-flex(xs4)
v-card.radius-7(
hover
light
@ -66,7 +66,17 @@
img(src='/svg/icon-markdown.svg', alt='Markdown', style='width: 36px;')
.body-2.mt-2 Markdown
.caption.grey--text Default
v-flex(xs3)
v-flex(xs4)
v-card.radius-7.grey(
hover
light
ripple
)
v-card-text.text-xs-center(@click='selectEditor("tabular")')
img(src='/svg/icon-table.svg', alt='Tabular', style='width: 36px;')
.body-2.grey--text.mt-2.text--darken-2 Tabular
.caption.grey--text.text--darken-1 Excel-like
v-flex(xs4)
v-card.radius-7.grey(
hover
light
@ -76,6 +86,16 @@
img(src='/svg/icon-open-in-browser.svg', alt='Visual Builder', style='width: 36px;')
.body-2.mt-2.grey--text.text--darken-2 Visual Builder
.caption.grey--text.text--darken-1 Drag-n-drop
v-flex(xs4)
v-card.radius-7.grey(
hover
light
ripple
)
v-card-text.text-xs-center(@click='selectEditor("wikitext")')
img(src='/svg/icon-news.svg', alt='WikiText', style='width: 36px;')
.body-2.grey--text.mt-2.text--darken-2 WikiText
.caption.grey--text.text--darken-1 MediaWiki Format
.caption.blue--text.text--lighten-2 This cannot be changed once the page is created.
loader(v-model='dialogProgress', :title='$t(`editor:save.processing`)', :subtitle='$t(`editor:save.pleaseWait`)')
@ -95,6 +115,7 @@
import _ from 'lodash'
import { get, sync } from 'vuex-pathify'
import { AtomSpinner } from 'epic-spinners'
import { Base64 } from 'js-base64'
import createPageMutation from 'gql/editor/create.gql'
import updatePageMutation from 'gql/editor/update.gql'
@ -182,7 +203,7 @@ export default {
},
mounted() {
this.$store.set('editor/mode', this.initMode || 'create')
this.$store.set('editor/content', this.initContent ? window.atob(this.initContent) : '# Header\n\nYour content here')
this.$store.set('editor/content', this.initContent ? Base64.decode(this.initContent) : '# Header\n\nYour content here')
if (this.mode === 'create') {
_.delay(() => {
this.dialogEditorSelector = true

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="&#1057;&#1083;&#1086;&#1081;_1" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve" width="96px" height="96px">
<linearGradient id="SVGID_1__44030" gradientUnits="userSpaceOnUse" x1="31" y1="28.6667" x2="31" y2="43.5458" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<path style="fill:url(#SVGID_1__44030);" d="M34,43h-6c-0.552,0-1-0.448-1-1V30c0-0.552,0.448-1,1-1h6c0.552,0,1,0.448,1,1v12 C35,42.552,34.552,43,34,43z"/>
<linearGradient id="SVGID_2__44030" gradientUnits="userSpaceOnUse" x1="32" y1="9.75" x2="32" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<path style="fill:url(#SVGID_2__44030);" d="M53.489,19.023c-0.164-0.015-0.326,0.005-0.489,0.005V19H42v-6c0-1.654-1.346-3-3-3H9 c-1.654,0-3,1.346-3,3v36c0,2.757,2.243,5,5,5h34l0,0c0.004,0,0.007,0,0.011,0c0.158,0,0.317-0.008,0.477-0.023 C48.018,53.736,50,51.474,50,48.828V46h6c1.103,0,2-0.897,2-2V24.172C58,21.527,56.019,19.265,53.489,19.023z M42,31h2v10h-2V31z M8,49V13c0-0.551,0.448-1,1-1h30c0.552,0,1,0.449,1,1v36c0,1.09,0.367,2.14,1.013,3H11C9.346,52,8,50.654,8,49z M48,23.997v24.832 c0,1.626-1.188,3.013-2.702,3.158c-0.856,0.085-1.683-0.189-2.315-0.766C42.358,50.653,42,49.843,42,49v-6h2c1.103,0,2-0.897,2-2V31 c0-1.103-0.897-2-2-2h-2v-2h4v-2h-4v-4h7.012C48.367,21.86,48,22.908,48,23.997z M56,44h-6v-5h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2 v-2h-2v-1.003c0-0.842,0.357-1.649,0.981-2.217c0.634-0.576,1.448-0.848,2.318-0.765c1.514,0.145,2.7,1.531,2.7,3.157V44z"/>
<linearGradient id="SVGID_3__44030" gradientUnits="userSpaceOnUse" x1="23" y1="9.75" x2="23" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="21" style="fill:url(#SVGID_3__44030);" width="24" height="2"/>
<linearGradient id="SVGID_4__44030" gradientUnits="userSpaceOnUse" x1="23" y1="9.75" x2="23" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="25" style="fill:url(#SVGID_4__44030);" width="24" height="2"/>
<linearGradient id="SVGID_5__44030" gradientUnits="userSpaceOnUse" x1="17.5" y1="9.75" x2="17.5" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="29" style="fill:url(#SVGID_5__44030);" width="13" height="2"/>
<linearGradient id="SVGID_6__44030" gradientUnits="userSpaceOnUse" x1="17.5" y1="9.75" x2="17.5" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="33" style="fill:url(#SVGID_6__44030);" width="13" height="2"/>
<linearGradient id="SVGID_7__44030" gradientUnits="userSpaceOnUse" x1="17.5" y1="9.75" x2="17.5" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="37" style="fill:url(#SVGID_7__44030);" width="13" height="2"/>
<linearGradient id="SVGID_8__44030" gradientUnits="userSpaceOnUse" x1="17.5" y1="9.75" x2="17.5" y2="54.5844" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<rect x="11" y="41" style="fill:url(#SVGID_8__44030);" width="13" height="2"/>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve" width="512px" height="512px">
<linearGradient id="SVGID_1__48254_62186" gradientUnits="userSpaceOnUse" x1="32" y1="7" x2="32" y2="57.0812" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<path style="fill:url(#SVGID_1__48254_62186);" d="M52,7H12c-2.757,0-5,2.243-5,5v40c0,2.757,2.243,5,5,5h40c2.757,0,5-2.243,5-5V12 C57,9.243,54.757,7,52,7z M43,31H33V21h10V31z M45,21h10v10H45V21z M33,19V9h10v10H33z M31,19H21V9h10V19z M31,21v10H21V21H31z M19,31H9V21h10V31z M9,33h10v10H9V33z M21,33h10v10H21V33z M31,45v10H21V45H31z M33,45h10v10H33V45z M33,43V33h10v10H33z M45,33h10 v10H45V33z M55,12v7H45V9h7C53.654,9,55,10.346,55,12z M12,9h7v10H9v-7C9,10.346,10.346,9,12,9z M9,52v-7h10v10h-7 C10.346,55,9,53.654,9,52z M52,55h-7V45h10v7C55,53.654,53.654,55,52,55z"/>
<g>
<linearGradient id="SVGID_2__48254_62186" gradientUnits="userSpaceOnUse" x1="14" y1="23.0417" x2="14" y2="28.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<rect x="11" y="23" style="fill:url(#SVGID_2__48254_62186);" width="6" height="6"/>
<linearGradient id="SVGID_3__48254_62186" gradientUnits="userSpaceOnUse" x1="26" y1="11.0417" x2="26" y2="16.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<rect x="23" y="11" style="fill:url(#SVGID_3__48254_62186);" width="6" height="6"/>
<linearGradient id="SVGID_4__48254_62186" gradientUnits="userSpaceOnUse" x1="38" y1="11.0417" x2="38" y2="16.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<rect x="35" y="11" style="fill:url(#SVGID_4__48254_62186);" width="6" height="6"/>
<linearGradient id="SVGID_5__48254_62186" gradientUnits="userSpaceOnUse" x1="50" y1="11.0417" x2="50" y2="16.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<path style="fill:url(#SVGID_5__48254_62186);" d="M47,17h6v-5c0-0.552-0.448-1-1-1h-5V17z"/>
<linearGradient id="SVGID_6__48254_62186" gradientUnits="userSpaceOnUse" x1="14" y1="11.0417" x2="14" y2="16.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<path style="fill:url(#SVGID_6__48254_62186);" d="M12,11c-0.552,0-1,0.448-1,1v5h6v-6H12z"/>
<linearGradient id="SVGID_7__48254_62186" gradientUnits="userSpaceOnUse" x1="14" y1="35.0417" x2="14" y2="40.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<rect x="11" y="35" style="fill:url(#SVGID_7__48254_62186);" width="6" height="6"/>
<linearGradient id="SVGID_8__48254_62186" gradientUnits="userSpaceOnUse" x1="14" y1="47.0417" x2="14" y2="52.9623" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<path style="fill:url(#SVGID_8__48254_62186);" d="M11,52c0,0.552,0.448,1,1,1h5v-6h-6V52z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -42,6 +42,7 @@
"apollo-server-express": "2.2.2",
"auto-load": "3.0.4",
"axios": "0.18.0",
"js-base64": "2.5.0",
"bcryptjs-then": "1.0.1",
"bluebird": "3.5.3",
"body-parser": "1.18.3",

@ -60,7 +60,7 @@ module.exports = {
},
async register(obj, args, context) {
try {
await WIKI.models.users.register(args, context)
await WIKI.models.users.register({...args, verify: true }, context)
return {
responseResult: graphHelper.generateSuccess('Registration success')
}

@ -30,7 +30,11 @@ module.exports = {
},
UserMutation: {
create(obj, args) {
return WIKI.models.users.query().insertAndFetch(args)
return WIKI.models.users.register({
...args,
verify: false,
bypassChecks: true
})
},
delete(obj, args) {
return WIKI.models.users.query().deleteById(args.id)

@ -296,10 +296,13 @@ module.exports = class User extends Model {
throw new WIKI.Error.AuthTFAInvalid()
}
static async register ({ email, password, name }, context) {
static async register ({ email, password, name, verify = false, bypassChecks = false }, context) {
const localStrg = await WIKI.models.authentication.getStrategy('local')
// Check if self-registration is enabled
if (localStrg.selfRegistration) {
if (localStrg.selfRegistration || bypassChecks) {
// Input sanitization
email = _.toLower(email)
// Input validation
const validation = validate({
email,
@ -335,7 +338,7 @@ module.exports = class User extends Model {
}
// Check if email domain is whitelisted
if (_.get(localStrg, 'domainWhitelist.v', []).length > 0) {
if (_.get(localStrg, 'domainWhitelist.v', []).length > 0 && !bypassChecks) {
const emailDomain = _.last(email.split('@'))
if (!_.includes(localStrg.domainWhitelist.v, emailDomain)) {
throw new WIKI.Error.AuthRegistrationDomainUnauthorized()
@ -358,26 +361,28 @@ module.exports = class User extends Model {
isVerified: false
})
// Create verification token
const verificationToken = await WIKI.models.userKeys.generateToken({
kind: 'verify',
userId: newUsr.id
})
if (verify) {
// Create verification token
const verificationToken = await WIKI.models.userKeys.generateToken({
kind: 'verify',
userId: newUsr.id
})
// Send verification email
await WIKI.mail.send({
template: 'accountVerify',
to: email,
subject: 'Verify your account',
data: {
preheadertext: 'Verify your account in order to gain access to the wiki.',
title: 'Verify your account',
content: 'Click the button below in order to verify your account and gain access to the wiki.',
buttonLink: `${WIKI.config.host}/verify/${verificationToken}`,
buttonText: 'Verify'
},
text: `You must open the following link in your browser to verify your account and gain access to the wiki: ${WIKI.config.host}/verify/${verificationToken}`
})
// Send verification email
await WIKI.mail.send({
template: 'accountVerify',
to: email,
subject: 'Verify your account',
data: {
preheadertext: 'Verify your account in order to gain access to the wiki.',
title: 'Verify your account',
content: 'Click the button below in order to verify your account and gain access to the wiki.',
buttonLink: `${WIKI.config.host}/verify/${verificationToken}`,
buttonText: 'Verify'
},
text: `You must open the following link in your browser to verify your account and gain access to the wiki: ${WIKI.config.host}/verify/${verificationToken}`
})
}
return true
} else {
throw new WIKI.Error.AuthAccountAlreadyExists()

Loading…
Cancel
Save