Commit a155af20 authored by NGPixel's avatar NGPixel

feat: added auth0, discord, twitch auth modules

parent a4e0e6d3
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
.login-frame .login-frame
h1 {{ siteTitle }} h1 {{ siteTitle }}
h2 {{ $t('auth:loginrequired') }} h2 {{ $t('auth:loginrequired') }}
input(type='text', name='email', :placeholder='$t("auth:fields.emailuser")') input(type='text', ref='iptEmail', :placeholder='$t("auth:fields.emailuser")')
input(type='password', name='password', :placeholder='$t("auth:fields.password")') input(type='password', ref='iptPassword', :placeholder='$t("auth:fields.password")')
button.button.is-orange.is-fullwidth(@click='login') button.button.is-blue.is-fullwidth(@click='login')
span {{ $t('auth:actions.login') }} span {{ $t('auth:actions.login') }}
.login-copyright .login-copyright
span {{ $t('footer.poweredby') }} span {{ $t('footer.poweredby') }}
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
mounted() { mounted() {
this.$store.commit('navigator/subtitleStatic', 'Login') this.$store.commit('navigator/subtitleStatic', 'Login')
this.refreshStrategies() this.refreshStrategies()
this.$refs.iptEmail.focus()
} }
} }
</script> </script>
...@@ -22,26 +22,34 @@ ...@@ -22,26 +22,34 @@
transition(name='navigator-sd') transition(name='navigator-sd')
.navigator-sd(v-show='sdShown') .navigator-sd(v-show='sdShown')
.navigator-sd-actions .navigator-sd-actions
a.is-active(href='') a.is-active(href='', title='Search')
svg.icons.is-24(role='img') svg.icons.is-24(role='img')
title Search title Search
use(xlink:href='#gg-search') use(xlink:href='#gg-search')
a(href='') a(href='')
svg.icons.is-24(role='img') svg.icons.is-24(role='img', title='New Document')
title New Document title New Document
use(xlink:href='#nc-plus-circle') use(xlink:href='#nc-plus-circle')
a(href='') a(href='')
svg.icons.is-24(role='img') svg.icons.is-24(role='img', title='Edit Document')
title Navigation title Edit Document
use(xlink:href='#nc-pen-red') use(xlink:href='#nc-pen-red')
a(href='') a(href='')
svg.icons.is-24(role='img') svg.icons.is-24(role='img', title='History')
title Navigation title History
use(xlink:href='#nc-restore') use(xlink:href='#nc-restore')
a(href='') a(href='')
svg.icons.is-24(role='img') svg.icons.is-24(role='img', title='View Source')
title New Document title View Source
use(xlink:href='#nc-code-editor') 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 .navigator-sd-search
input(type='text', placeholder='Search') input(type='text', placeholder='Search')
.navigator-sd-results .navigator-sd-results
......
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
input[type=text], input[type=password] { input[type=text], input[type=password] {
width: 100%; width: 100%;
border: 1px solid rgba(mc('light-blue','500'), .5); border: 1px solid rgba(mc('blue-grey','500'), .5);
border-radius: 3px; border-radius: 3px;
background-color: rgba(255,255,255,.9); background-color: rgba(255,255,255,.9);
box-shadow: inset 0 0 0 3px rgba(255,255,255, .25); box-shadow: inset 0 0 0 3px rgba(255,255,255, .25);
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
} }
.button { .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-repeat: no-repeat;
background-size: 100% 200%; background-size: 100% 200%;
......
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <svg
xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="nc-check-simple" viewBox="0 0 64 64"> <symbol id="nc-check-simple" viewBox="0 0 64 64">
<g> <g>
<g class="nc-icon-wrapper"> <g class="nc-icon-wrapper">
...@@ -389,7 +390,7 @@ ...@@ -389,7 +390,7 @@
<path fill="#B3B3B3" d="M24,42c10.539,0,18.992-9.105,17.906-19.862c-0.862-8.531-7.863-15.387-16.409-16.077 c-6.106-0.493-11.83,2.057-15.508,6.629l7.65-1.024l0.531,3.965L6.276,17.223c-0.09,0.012-0.18,0.018-0.269,0.018 c-0.986,0-1.845-0.729-1.979-1.734L2.436,3.612L6.4,3.081l0.886,6.617c4.686-5.496,11.853-8.446,19.428-7.535 c10.097,1.214,18.149,9.444,19.17,19.562C47.212,34.873,36.881,46,24,46C12.213,46,2.561,36.682,2.024,25.026 C1.998,24.464,2.464,24,3.026,24h2.003c0.541,0,0.969,0.431,0.997,0.972C6.532,34.447,14.401,42,24,42z"></path> <path fill="#B3B3B3" d="M24,42c10.539,0,18.992-9.105,17.906-19.862c-0.862-8.531-7.863-15.387-16.409-16.077 c-6.106-0.493-11.83,2.057-15.508,6.629l7.65-1.024l0.531,3.965L6.276,17.223c-0.09,0.012-0.18,0.018-0.269,0.018 c-0.986,0-1.845-0.729-1.979-1.734L2.436,3.612L6.4,3.081l0.886,6.617c4.686-5.496,11.853-8.446,19.428-7.535 c10.097,1.214,18.149,9.444,19.17,19.562C47.212,34.873,36.881,46,24,46C12.213,46,2.561,36.682,2.024,25.026 C1.998,24.464,2.464,24,3.026,24h2.003c0.541,0,0.969,0.431,0.997,0.972C6.532,34.447,14.401,42,24,42z"></path>
<path fill="#43A6DD" d="M29.879,32.707l-7.293-7.293C22.211,25.039,22,24.53,22,23.999V15c0-0.552,0.448-1,1-1h2 c0.552,0,1,0.448,1,1v8.172l6.707,6.707c0.391,0.391,0.391,1.024,0,1.414l-1.414,1.414C30.903,33.097,30.269,33.097,29.879,32.707z"></path> <path fill="#43A6DD" d="M29.879,32.707l-7.293-7.293C22.211,25.039,22,24.53,22,23.999V15c0-0.552,0.448-1,1-1h2 c0.552,0,1,0.448,1,1v8.172l6.707,6.707c0.391,0.391,0.391,1.024,0,1.414l-1.414,1.414C30.903,33.097,30.269,33.097,29.879,32.707z"></path>
</g> </g>
</symbol> </symbol>
<symbol id='nc-code-editor' viewBox="0 0 48 48"> <symbol id='nc-code-editor' viewBox="0 0 48 48">
<g class="nc-icon-wrapper"> <g class="nc-icon-wrapper">
<path fill="#444444" d="M47,11V6c0-1.105-0.895-2-2-2H3C1.895,4,1,4.895,1,6v5H47z"></path> <path fill="#444444" d="M47,11V6c0-1.105-0.895-2-2-2H3C1.895,4,1,4.895,1,6v5H47z"></path>
...@@ -410,4 +411,20 @@ ...@@ -410,4 +411,20 @@
<rect x="20" y="38" fill="#E86C60" width="5" height="2"></rect> <rect x="20" y="38" fill="#E86C60" width="5" height="2"></rect>
</g> </g>
</symbol> </symbol>
<symbol id='nc-trash' viewBox="0 0 48 48">
<g class="nc-icon-wrapper">
<path fill="#335262" d="M37,47H11c-2.20914,0-4-1.79086-4-4V14c0-0.55229,0.44772-1,1-1h32c0.55228,0,1,0.44771,1,1v29 C41,45.20914,39.20914,47,37,47z"></path>
<path fill="#223E49" d="M24,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C25,38.55225,24.55273,39,24,39z"></path>
<path fill="#223E49" d="M16,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C17,38.55225,16.55273,39,16,39z"></path>
<path fill="#223E49" d="M32,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C33,38.55225,32.55273,39,32,39z"></path>
<path fill="#5A7A84" d="M30,11c-0.55273,0-1-0.44775-1-1V3H19v7c0,0.55225-0.44727,1-1,1s-1-0.44775-1-1V2c0-0.55225,0.44727-1,1-1 h12c0.55273,0,1,0.44775,1,1v8C31,10.55225,30.55273,11,30,11z"></path>
<path fill="#5A7A84" d="M46,14H2c-0.55273,0-1-0.44775-1-1V9c0-0.55225,0.44727-1,1-1h44c0.55273,0,1,0.44775,1,1v4 C47,13.55225,46.55273,14,46,14z"></path>
</g>
</symbol>
<symbol id='nc-move' viewBox="0 0 48 48">
<g class="nc-icon-wrapper">
<path fill="#B3B3B3" d="M47.658,33.247l-8-7c-0.294-0.257-0.715-0.32-1.071-0.157C38.229,26.252,38,26.607,38,27v5 c-7.171,0-11.745-4.573-16.586-9.414C16.21,17.382,10.829,12,2,12H1c-0.552,0-1,0.448-1,1v2c0,0.552,0.448,1,1,1h1 c7.171,0,11.745,4.573,16.586,9.414C23.79,30.618,29.171,36,38,36v5c0,0.393,0.229,0.748,0.587,0.91C38.719,41.971,38.86,42,39,42 c0.237,0,0.473-0.085,0.658-0.247l8-7C47.876,34.562,48,34.288,48,34S47.876,33.437,47.658,33.247z"></path>
<path fill="#444444" d="M47.658,13.247l-8-7c-0.294-0.257-0.715-0.32-1.071-0.157C38.229,6.252,38,6.607,38,7v5 c-8.829,0-14.21,5.382-19.414,10.586C13.745,27.427,9.171,32,2,32H1c-0.552,0-1,0.448-1,1v2c0,0.552,0.448,1,1,1h1 c8.829,0,14.21-5.382,19.414-10.586C26.255,20.573,30.829,16,38,16v5c0,0.393,0.229,0.748,0.587,0.91C38.719,21.971,38.86,22,39,22 c0.237,0,0.473-0.085,0.658-0.247l8-7C47.876,14.562,48,14.288,48,14S47.876,13.438,47.658,13.247z"></path>
</g>
</symbol>
</svg> </svg>
\ No newline at end of file
...@@ -100,13 +100,16 @@ ...@@ -100,13 +100,16 @@
"node-graceful": "0.2.3", "node-graceful": "0.2.3",
"ora": "1.3.0", "ora": "1.3.0",
"passport": "0.4.0", "passport": "0.4.0",
"passport-auth0": "0.6.1",
"passport-azure-ad-oauth2": "0.0.4", "passport-azure-ad-oauth2": "0.0.4",
"passport-discord": "0.1.3",
"passport-facebook": "2.1.1", "passport-facebook": "2.1.1",
"passport-github2": "0.1.11", "passport-github2": "0.1.11",
"passport-google-oauth20": "1.0.0", "passport-google-oauth20": "1.0.0",
"passport-ldapauth": "2.0.0", "passport-ldapauth": "2.0.0",
"passport-local": "1.0.0", "passport-local": "1.0.0",
"passport-slack": "0.0.7", "passport-slack": "0.0.7",
"passport-twitch": "1.0.3",
"passport-windowslive": "1.0.2", "passport-windowslive": "1.0.2",
"pg": "6.4.2", "pg": "6.4.2",
"pg-hstore": "2.3.2", "pg-hstore": "2.3.2",
......
/* 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
})
}
))
}
}
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'azure', key: 'azure',
title: 'Azure Active Directory', title: 'Azure Active Directory',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL', 'resource', 'tenant'], props: ['clientId', 'clientSecret', 'resource', 'tenant'],
init (passport, conf) { init (passport, conf) {
const jwt = require('jsonwebtoken') const jwt = require('jsonwebtoken')
passport.use('azure_ad_oauth2', passport.use('azure_ad_oauth2',
......
/* 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
})
}
))
}
}
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'facebook', key: 'facebook',
title: 'Facebook', title: 'Facebook',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL'], props: ['clientId', 'clientSecret'],
init (passport, conf) { init (passport, conf) {
passport.use('facebook', passport.use('facebook',
new FacebookStrategy({ new FacebookStrategy({
......
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'github', key: 'github',
title: 'GitHub', title: 'GitHub',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL'], props: ['clientId', 'clientSecret'],
init (passport, conf) { init (passport, conf) {
passport.use('github', passport.use('github',
new GitHubStrategy({ new GitHubStrategy({
......
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'google', key: 'google',
title: 'Google ID', title: 'Google ID',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL'], props: ['clientId', 'clientSecret'],
init (passport, conf) { init (passport, conf) {
passport.use('google', passport.use('google',
new GoogleStrategy({ new GoogleStrategy({
......
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'microsoft', key: 'microsoft',
title: 'Microsoft Account', title: 'Microsoft Account',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL'], props: ['clientId', 'clientSecret'],
init (passport, conf) { init (passport, conf) {
passport.use('microsoft', passport.use('microsoft',
new WindowsLiveStrategy({ new WindowsLiveStrategy({
......
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
key: 'slack', key: 'slack',
title: 'Slack', title: 'Slack',
useForm: false, useForm: false,
props: ['clientId', 'clientSecret', 'callbackURL'], props: ['clientId', 'clientSecret'],
init (passport, conf) { init (passport, conf) {
passport.use('slack', passport.use('slack',
new SlackStrategy({ new SlackStrategy({
......
/* 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
})
}
))
}
}
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment