diff --git a/client/js/components/login.vue b/client/js/components/login.vue index d50fcbd7..2a9164ee 100644 --- a/client/js/components/login.vue +++ b/client/js/components/login.vue @@ -9,9 +9,9 @@ .login-frame h1 {{ siteTitle }} h2 {{ $t('auth:loginrequired') }} - input(type='text', name='email', :placeholder='$t("auth:fields.emailuser")') - input(type='password', name='password', :placeholder='$t("auth:fields.password")') - button.button.is-orange.is-fullwidth(@click='login') + input(type='text', ref='iptEmail', :placeholder='$t("auth:fields.emailuser")') + input(type='password', ref='iptPassword', :placeholder='$t("auth:fields.password")') + button.button.is-blue.is-fullwidth(@click='login') span {{ $t('auth:actions.login') }} .login-copyright span {{ $t('footer.poweredby') }} @@ -69,6 +69,7 @@ export default { mounted() { this.$store.commit('navigator/subtitleStatic', 'Login') this.refreshStrategies() + this.$refs.iptEmail.focus() } } diff --git a/client/js/components/navigator.vue b/client/js/components/navigator.vue index a768e73c..3c255560 100644 --- a/client/js/components/navigator.vue +++ b/client/js/components/navigator.vue @@ -22,26 +22,34 @@ transition(name='navigator-sd') .navigator-sd(v-show='sdShown') .navigator-sd-actions - a.is-active(href='') + a.is-active(href='', title='Search') svg.icons.is-24(role='img') title Search use(xlink:href='#gg-search') a(href='') - svg.icons.is-24(role='img') + svg.icons.is-24(role='img', title='New Document') title New Document use(xlink:href='#nc-plus-circle') a(href='') - svg.icons.is-24(role='img') - title Navigation + svg.icons.is-24(role='img', title='Edit Document') + title Edit Document use(xlink:href='#nc-pen-red') a(href='') - svg.icons.is-24(role='img') - title Navigation + svg.icons.is-24(role='img', title='History') + title History use(xlink:href='#nc-restore') a(href='') - svg.icons.is-24(role='img') - title New Document + svg.icons.is-24(role='img', title='View Source') + title View Source use(xlink:href='#nc-code-editor') + a(href='') + svg.icons.is-24(role='img', title='Move Document') + title Move Document + use(xlink:href='#nc-move') + a(href='') + svg.icons.is-24(role='img', title='Delete Document') + title Delete Document + use(xlink:href='#nc-trash') .navigator-sd-search input(type='text', placeholder='Search') .navigator-sd-results diff --git a/client/scss/components/login.scss b/client/scss/components/login.scss index e9dd5166..104c9623 100644 --- a/client/scss/components/login.scss +++ b/client/scss/components/login.scss @@ -229,7 +229,7 @@ input[type=text], input[type=password] { width: 100%; - border: 1px solid rgba(mc('light-blue','500'), .5); + border: 1px solid rgba(mc('blue-grey','500'), .5); border-radius: 3px; background-color: rgba(255,255,255,.9); box-shadow: inset 0 0 0 3px rgba(255,255,255, .25); @@ -253,7 +253,7 @@ } .button { - background-image: linear-gradient(to top, mc('deep-orange', '400') 0%, mc('deep-orange', '400') 50%, mc('orange', '500') 100%); + background-image: linear-gradient(to bottom, mc('blue', '400') 0%, mc('blue', '600') 50%, mc('blue', '700') 100%); background-repeat: no-repeat; background-size: 100% 200%; diff --git a/client/svg/icons.svg b/client/svg/icons.svg index 653360b4..6c85ebdc 100644 --- a/client/svg/icons.svg +++ b/client/svg/icons.svg @@ -1,4 +1,5 @@ - + @@ -389,7 +390,7 @@ - + @@ -410,4 +411,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/package.json b/package.json index 471aa9f1..b763c21d 100644 --- a/package.json +++ b/package.json @@ -100,13 +100,16 @@ "node-graceful": "0.2.3", "ora": "1.3.0", "passport": "0.4.0", + "passport-auth0": "0.6.1", "passport-azure-ad-oauth2": "0.0.4", + "passport-discord": "0.1.3", "passport-facebook": "2.1.1", "passport-github2": "0.1.11", "passport-google-oauth20": "1.0.0", "passport-ldapauth": "2.0.0", "passport-local": "1.0.0", "passport-slack": "0.0.7", + "passport-twitch": "1.0.3", "passport-windowslive": "1.0.2", "pg": "6.4.2", "pg-hstore": "2.3.2", diff --git a/server/extensions/authentication/auth0.js b/server/extensions/authentication/auth0.js new file mode 100644 index 00000000..63146980 --- /dev/null +++ b/server/extensions/authentication/auth0.js @@ -0,0 +1,30 @@ +/* global wiki */ + +// ------------------------------------ +// Auth0 Account +// ------------------------------------ + +const Auth0Strategy = require('passport-auth0').Strategy + +module.exports = { + key: 'auth0', + title: 'Auth0', + useForm: false, + props: ['domain', 'clientId', 'clientSecret'], + init (passport, conf) { + passport.use('auth0', + new Auth0Strategy({ + domain: conf.domain, + clientID: conf.clientId, + clientSecret: conf.clientSecret, + callbackURL: conf.callbackURL + }, function (accessToken, refreshToken, profile, cb) { + wiki.db.User.processProfile(profile).then((user) => { + return cb(null, user) || true + }).catch((err) => { + return cb(err, null) || true + }) + } + )) + } +} diff --git a/server/extensions/authentication/azure.js b/server/extensions/authentication/azure.js index 29ae7214..5d75bd4f 100644 --- a/server/extensions/authentication/azure.js +++ b/server/extensions/authentication/azure.js @@ -10,7 +10,7 @@ module.exports = { key: 'azure', title: 'Azure Active Directory', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL', 'resource', 'tenant'], + props: ['clientId', 'clientSecret', 'resource', 'tenant'], init (passport, conf) { const jwt = require('jsonwebtoken') passport.use('azure_ad_oauth2', diff --git a/server/extensions/authentication/discord.js b/server/extensions/authentication/discord.js new file mode 100644 index 00000000..eb2676c2 --- /dev/null +++ b/server/extensions/authentication/discord.js @@ -0,0 +1,30 @@ +/* global wiki */ + +// ------------------------------------ +// Discord Account +// ------------------------------------ + +const DiscordStrategy = require('passport-discord').Strategy + +module.exports = { + key: 'discord', + title: 'Discord', + useForm: false, + props: ['clientId', 'clientSecret'], + init (passport, conf) { + passport.use('discord', + new DiscordStrategy({ + clientID: conf.clientId, + clientSecret: conf.clientSecret, + callbackURL: conf.callbackURL, + scope: 'identify email' + }, function (accessToken, refreshToken, profile, cb) { + wiki.db.User.processProfile(profile).then((user) => { + return cb(null, user) || true + }).catch((err) => { + return cb(err, null) || true + }) + } + )) + } +} diff --git a/server/extensions/authentication/facebook.js b/server/extensions/authentication/facebook.js index bade7ac0..f0e33da5 100644 --- a/server/extensions/authentication/facebook.js +++ b/server/extensions/authentication/facebook.js @@ -10,7 +10,7 @@ module.exports = { key: 'facebook', title: 'Facebook', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL'], + props: ['clientId', 'clientSecret'], init (passport, conf) { passport.use('facebook', new FacebookStrategy({ diff --git a/server/extensions/authentication/github.js b/server/extensions/authentication/github.js index f2d5727c..941ced15 100644 --- a/server/extensions/authentication/github.js +++ b/server/extensions/authentication/github.js @@ -10,7 +10,7 @@ module.exports = { key: 'github', title: 'GitHub', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL'], + props: ['clientId', 'clientSecret'], init (passport, conf) { passport.use('github', new GitHubStrategy({ diff --git a/server/extensions/authentication/google.js b/server/extensions/authentication/google.js index 73995f54..e2fb4824 100644 --- a/server/extensions/authentication/google.js +++ b/server/extensions/authentication/google.js @@ -10,7 +10,7 @@ module.exports = { key: 'google', title: 'Google ID', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL'], + props: ['clientId', 'clientSecret'], init (passport, conf) { passport.use('google', new GoogleStrategy({ diff --git a/server/extensions/authentication/microsoft.js b/server/extensions/authentication/microsoft.js index 9bf9c7d9..1f61dbbb 100644 --- a/server/extensions/authentication/microsoft.js +++ b/server/extensions/authentication/microsoft.js @@ -10,7 +10,7 @@ module.exports = { key: 'microsoft', title: 'Microsoft Account', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL'], + props: ['clientId', 'clientSecret'], init (passport, conf) { passport.use('microsoft', new WindowsLiveStrategy({ diff --git a/server/extensions/authentication/slack.js b/server/extensions/authentication/slack.js index 04cedcb1..04d49c1d 100644 --- a/server/extensions/authentication/slack.js +++ b/server/extensions/authentication/slack.js @@ -10,7 +10,7 @@ module.exports = { key: 'slack', title: 'Slack', useForm: false, - props: ['clientId', 'clientSecret', 'callbackURL'], + props: ['clientId', 'clientSecret'], init (passport, conf) { passport.use('slack', new SlackStrategy({ diff --git a/server/extensions/authentication/twitch.js b/server/extensions/authentication/twitch.js new file mode 100644 index 00000000..0dae0c1d --- /dev/null +++ b/server/extensions/authentication/twitch.js @@ -0,0 +1,30 @@ +/* global wiki */ + +// ------------------------------------ +// Twitch Account +// ------------------------------------ + +const TwitchStrategy = require('passport-twitch').Strategy + +module.exports = { + key: 'twitch', + title: 'Twitch', + useForm: false, + props: ['clientId', 'clientSecret'], + init (passport, conf) { + passport.use('twitch', + new TwitchStrategy({ + clientID: conf.clientId, + clientSecret: conf.clientSecret, + callbackURL: conf.callbackURL, + scope: 'user_read' + }, function (accessToken, refreshToken, profile, cb) { + wiki.db.User.processProfile(profile).then((user) => { + return cb(null, user) || true + }).catch((err) => { + return cb(err, null) || true + }) + } + )) + } +} diff --git a/yarn.lock b/yarn.lock index 3b736024..9cc2de1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6164,12 +6164,26 @@ parseurl@~1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" +passport-auth0@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/passport-auth0/-/passport-auth0-0.6.1.tgz#8a6ace06b5d1927aaad15e22e1c43b9b04e5ddee" + dependencies: + passport-oauth "^1.0.0" + request "^2.61.0" + xtend "^4.0.0" + passport-azure-ad-oauth2@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/passport-azure-ad-oauth2/-/passport-azure-ad-oauth2-0.0.4.tgz#1a09d8869efd4afd095116e228941961b3a5c120" dependencies: passport-oauth "1.0.x" +passport-discord@0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/passport-discord/-/passport-discord-0.1.3.tgz#669cc4a770b592f57eb17002ca1743a22e8d7c38" + dependencies: + passport-oauth2 "^1.2.0" + passport-facebook@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/passport-facebook/-/passport-facebook-2.1.1.tgz#c39d0b52ae4d59163245a4e21a7b9b6321303311" @@ -6211,7 +6225,7 @@ passport-oauth1@1.x.x: passport-strategy "1.x.x" utils-merge "1.x.x" -passport-oauth2@1.x.x: +passport-oauth2@1.x.x, passport-oauth2@^1.1.2, passport-oauth2@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.4.0.tgz#f62f81583cbe12609be7ce6f160b9395a27b86ad" dependencies: @@ -6220,7 +6234,7 @@ passport-oauth2@1.x.x: uid2 "0.0.x" utils-merge "1.x.x" -passport-oauth@1.0.x: +passport-oauth@1.0.x, passport-oauth@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/passport-oauth/-/passport-oauth-1.0.0.tgz#90aff63387540f02089af28cdad39ea7f80d77df" dependencies: @@ -6246,6 +6260,13 @@ passport-strategy@1.x.x, passport-strategy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/passport-strategy/-/passport-strategy-1.0.0.tgz#b5539aa8fc225a3d1ad179476ddf236b440f52e4" +passport-twitch@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/passport-twitch/-/passport-twitch-1.0.3.tgz#82a4a1fbe19368d44e62f057e93c414a9d4fe7cc" + dependencies: + passport-oauth2 "^1.1.2" + pkginfo "0.2.x" + passport-windowslive@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/passport-windowslive/-/passport-windowslive-1.0.2.tgz#383cfee6589ffb5ecc2ad19c3a41ef691462a705" @@ -7158,7 +7179,7 @@ request@2, request@^2.65.0, request@^2.67.0, request@^2.79.0, request@^2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@2.83.0, request@^2.83.0: +request@2.83.0, request@^2.61.0, request@^2.83.0: version "2.83.0" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" dependencies: