mirror of https://github.com/Requarks/wiki.git
13 changed files with 165 additions and 28 deletions
Unified View
Diff Options
-
9assets/svg/auth-icon-azure.svg
-
8assets/svg/auth-icon-local.svg
-
11client/js/app.js
-
36client/js/components/login.vue
-
22client/js/constants/graphql.js
-
5client/js/constants/index.js
-
19client/js/modules/localization.js
-
6client/scss/components/button.scss
-
30client/scss/pages/_login.scss
-
2server/authentication/microsoft.js
-
2server/modules/graphql.js
-
40server/schemas/resolvers-authentication.js
-
3server/schemas/types.graphql
9
assets/svg/auth-icon-azure.svg
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,8 @@ |
|||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
||||
|
width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"> |
||||
|
<path d="M32,19c13.089,0,27-3.154,27-9S45.089,1,32,1S5,4.154,5,10S18.911,19,32,19z"/> |
||||
|
<path d="M32,41c13.089,0,27-3.154,27-9V14.436c-1.481,1.493-3.963,2.968-8.022,4.174C45.864,20.128,38.946,21,32,21 |
||||
|
s-13.864-0.872-18.978-2.391C8.963,17.403,6.481,15.929,5,14.436V32C5,37.846,18.911,41,32,41z"/> |
||||
|
<path d="M32,63c13.089,0,27-3.154,27-9V36.436c-1.481,1.493-3.963,2.968-8.022,4.174C45.864,42.128,38.946,43,32,43 |
||||
|
s-13.864-0.872-18.978-2.391C8.963,39.403,6.481,37.929,5,36.436V54C5,59.846,18.911,63,32,63z"/> |
||||
|
</svg> |
@ -0,0 +1,22 @@ |
|||||
|
import gql from 'graphql-tag' |
||||
|
|
||||
|
export default { |
||||
|
GQL_QUERY_AUTHENTICATION: gql`
|
||||
|
query($mode: String!) { |
||||
|
authentication(mode:$mode) { |
||||
|
key |
||||
|
useForm |
||||
|
title |
||||
|
icon |
||||
|
} |
||||
|
} |
||||
|
`,
|
||||
|
GQL_QUERY_TRANSLATIONS: gql`
|
||||
|
query($locale: String!, $namespace: String!) { |
||||
|
translations(locale:$locale, namespace:$namespace) { |
||||
|
key |
||||
|
value |
||||
|
} |
||||
|
} |
||||
|
`
|
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
import GRAPHQL from './graphql' |
||||
|
|
||||
|
export default { |
||||
|
GRAPHQL |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
const _ = require('lodash') |
||||
|
const fs = require('fs-extra') |
||||
|
const path = require('path') |
||||
|
|
||||
|
/* global wiki */ |
||||
|
|
||||
|
module.exports = { |
||||
|
Query: { |
||||
|
authentication(obj, args, context, info) { |
||||
|
switch (args.mode) { |
||||
|
case 'active': |
||||
|
let strategies = _.chain(wiki.auth.strategies).map(str => { |
||||
|
return { |
||||
|
key: str.key, |
||||
|
title: str.title, |
||||
|
useForm: str.useForm |
||||
|
} |
||||
|
}).sortBy(['title']).value() |
||||
|
let localStrategy = _.remove(strategies, str => str.key === 'local') |
||||
|
return _.concat(localStrategy, strategies) |
||||
|
case 'all': |
||||
|
|
||||
|
break |
||||
|
default: |
||||
|
return null |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
Mutation: {}, |
||||
|
AuthenticationProvider: { |
||||
|
icon (ap, args) { |
||||
|
return fs.readFileAsync(path.join(wiki.ROOTPATH, `assets/svg/auth-icon-${ap.key}.svg`), 'utf8').catch(err => { |
||||
|
if (err.code === 'ENOENT') { |
||||
|
return null |
||||
|
} |
||||
|
throw err |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save