diff --git a/client/app.js b/client/app.js index 4097d93b..47f3d072 100644 --- a/client/app.js +++ b/client/app.js @@ -49,11 +49,33 @@ moment.locale(siteConfig.lang) const graphQLEndpoint = window.location.protocol + '//' + window.location.host + '/graphql' -const graphQLLink = createPersistedQueryLink().concat(createHttpLink({ - includeExtensions: true, - uri: graphQLEndpoint, - credentials: 'include' -})) +const graphQLLink = createPersistedQueryLink().concat( + createHttpLink({ + includeExtensions: true, + uri: graphQLEndpoint, + credentials: 'include', + fetch: (uri, options) => { + // Strip __typename fields from variables + let body = JSON.parse(options.body) + // body = body.map(bd => { + // return ({ + // ...bd, + // variables: JSON.parse(JSON.stringify(bd.variables), (key, value) => { return key === '__typename' ? undefined : value }) + // }) + // }) + body = { + ...body, + variables: JSON.parse(JSON.stringify(body.variables), (key, value) => { return key === '__typename' ? undefined : value }) + } + options.body = JSON.stringify(body) + + // Inject authentication token + options.headers.Authorization = `Bearer TODO` + + return fetch(uri, options) + } + }) +) window.graphQL = new ApolloClient({ link: graphQLLink, diff --git a/client/components/admin/admin-auth.vue b/client/components/admin/admin-auth.vue index 5d5cb861..9a1cf93d 100644 --- a/client/components/admin/admin-auth.vue +++ b/client/components/admin/admin-auth.vue @@ -13,12 +13,11 @@ .caption.grey--text.pb-2 Some strategies require additional configuration in their dedicated tab (when selected). v-form v-checkbox( - v-for='strategy in strategies', - v-model='selectedStrategies', - :key='strategy.key', - :label='strategy.title', - :value='strategy.key', - color='primary', + v-for='strategy in strategies' + v-model='strategy.isEnabled' + :key='strategy.key' + :label='strategy.title' + color='primary' :disabled='strategy.key === `local`' hide-details ) @@ -38,29 +37,43 @@ ) v-divider v-subheader.pl-0 Registration - v-switch.ml-3( - v-model='allowSelfRegistration', - label='Allow self-registration', - :value='true', - color='primary', - hint='Allow any user successfully authorized by the strategy to access the wiki.', - persistent-hint - ) - v-text-field.ml-3( - label='Limit to specific email domains' - prepend-icon='mail_outline' - hint='Domain(s) seperated by comma. (e.g. domain1.com, domain2.com)' - persistent-hint - ) - v-text-field.ml-3( - label='Assign to group' - prepend-icon='people' - hint='Automatically assign new users to these groups.' - persistent-hint + .pr-3 + v-switch.ml-3( + v-model='strategy.selfRegistration' + label='Allow self-registration' + color='primary' + hint='Allow any user successfully authorized by the strategy to access the wiki.' + persistent-hint ) + v-select.ml-3( + label='Limit to specific email domains' + v-model='strategy.domainWhitelist' + prepend-icon='mail_outline' + persistent-hint + deletable-chips + clearable + multiple + chips + tags + ) + v-select.ml-3( + :items='groups' + item-text='name' + item-value='id' + label='Assign to group' + v-model='strategy.autoEnrollGroups' + prepend-icon='people' + hint='Automatically assign new users to these groups.' + persistent-hint + deletable-chips + autocomplete + clearable + multiple + chips + ) v-card-chin - v-btn(color='primary') + v-btn(color='primary', @click='save') v-icon(left) chevron_right span Save v-spacer @@ -72,22 +85,20 @@