mirror of https://github.com/requarks/wiki
parent
fa7391ea4b
commit
dc6fc449f0
@ -1,16 +0,0 @@
|
||||
failThreshold: high
|
||||
version: v1.5.2
|
||||
ignore:
|
||||
'npm:moment:20160126':
|
||||
- express-brute-mongo > moment:
|
||||
reason: None given
|
||||
expires: '2016-11-16T22:23:46.921Z'
|
||||
patch:
|
||||
'npm:negotiator:20160616':
|
||||
- socket.io > engine.io > accepts > negotiator:
|
||||
patched: '2016-09-09T02:19:31.082Z'
|
||||
'npm:ws:20160624':
|
||||
- socket.io > engine.io > ws:
|
||||
patched: '2016-09-09T02:19:31.082Z'
|
||||
- socket.io > socket.io-client > engine.io-client > ws:
|
||||
patched: '2016-09-09T02:19:31.082Z'
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
#bg,#bg>div{width:100%;height:100%;top:0;left:0}#root,#root button,#root h1,a{color:#FFF}html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}[v-cloak]{display:none}body{padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px}a{transition:color .4s ease;text-decoration:none}a:hover{color:#FB8C00;text-decoration:underline}#bg{position:fixed;z-index:1;background-color:#000}#bg>div{background-size:cover;background-position:center center;position:absolute;opacity:0;visibility:hidden;transition:opacity 3s ease,visibility 3s;animation:bg 30s linear infinite}#copyright,#root{display:flex;left:10vw;z-index:2}#bg>div:nth-child(1){animation-delay:10s}#bg>div:nth-child(2){animation-delay:20s}#root h1,#root h2{animation:headerIntro 3s ease;padding:0}#root{position:fixed;top:15vh;flex-direction:column}#root h1{font-size:4rem;margin:0}#root h2{font-size:1.5rem;font-weight:400;color:rgba(255,255,255,.7);margin:0 0 25px}#root input[type=password],#root input[type=text]{width:350px;max-width:80vw;border:1px solid rgba(255,255,255,.3);border-radius:3px;background-color:rgba(0,0,0,.2);padding:0 15px;height:40px;margin:0 0 10px;color:#FFF;font-weight:700;font-size:14px;transition:all .4s ease}#root input[type=password]:focus,#root input[type=text]:focus{outline:0;border-color:rgba(255,255,255,.8)}#root button{background-color:#FB8C00;border:1px solid #ffa32f;border-radius:3px;height:40px;width:125px;padding:0;font-weight:700;margin:15px 0 0;transition:all .4s ease;cursor:pointer}#root button:focus{outline:0;border-color:#FFF}#root button:hover{background-color:#c87000}#copyright{align-items:center;justify-content:flex-start;position:absolute;bottom:10vh;color:rgba(255,255,255,.5);font-weight:700}#copyright .icon{font-size:1.2rem;margin:0 8px}#copyright a{opacity:.75}@-webkit-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-moz-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-o-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-webkit-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@-moz-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@-o-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@keyframes headerIntro{0%{opacity:0}100%{opacity:1}}
|
||||
#bg,#bg>div{width:100%;height:100%;top:0;left:0}#root,#root button,#root h1,a{color:#FFF}html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}[v-cloak]{display:none}body{padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px}a{transition:color .4s ease;text-decoration:none}a:hover{color:#FB8C00;text-decoration:underline}#bg{position:fixed;z-index:1;background-color:#000}#bg>div{background-size:cover;background-position:center center;position:absolute;opacity:0;visibility:hidden;transition:opacity 3s ease,visibility 3s;animation:bg 30s linear infinite}#copyright,#root{left:10vw;z-index:2}#bg>div:nth-child(1){animation-delay:10s}#bg>div:nth-child(2){animation-delay:20s}#root h1,#root h2{animation:headerIntro 3s ease;padding:0}#root{position:fixed;top:15vh;display:flex;flex-direction:column}#root h1{font-size:4rem;margin:0}#root h2{font-size:1.5rem;font-weight:400;color:rgba(255,255,255,.7);margin:0 0 25px}#root input[type=password],#root input[type=text]{width:350px;max-width:80vw;border:1px solid rgba(255,255,255,.3);border-radius:3px;background-color:rgba(0,0,0,.2);padding:0 15px;height:40px;margin:0 0 10px;color:#FFF;font-weight:700;font-size:14px;transition:all .4s ease}#root input[type=password]:focus,#root input[type=text]:focus{outline:0;border-color:rgba(255,255,255,.8)}#root button{background-color:#FB8C00;border:1px solid #ffa32f;border-radius:3px;height:40px;width:125px;padding:0;font-weight:700;margin:15px 0 0;transition:all .4s ease;cursor:pointer}#root button:focus{outline:0;border-color:#FFF}#root button:hover{background-color:#c87000}#root #social{margin-top:25px}#root #social>span{display:block;font-weight:700;color:rgba(255,255,255,.7)}#root #social button{margin-right:5px;width:auto;padding:0 15px}#root #social button>i{margin-right:10px;font-size:16px}#root #social button.ms{background-color:#009688;border-color:#00c9b6}#root #social button.ms:hover{background-color:#00635a}#root #social button.google{background-color:#2196F3;border-color:#51adf6}#root #social button.google:hover{background-color:#0c7cd5}#root #social button.facebook{background-color:#673AB7;border-color:#8259cb}#root #social button.facebook:hover{background-color:#512e90}#copyright{display:flex;align-items:center;justify-content:flex-start;position:absolute;bottom:10vh;color:rgba(255,255,255,.5);font-weight:700}#copyright .icon{font-size:1.2rem;margin:0 8px}#copyright a{opacity:.75}@-webkit-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-moz-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-o-keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@keyframes bg{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1);visibility:visible;opacity:0}33%,5%{opacity:.5}38%{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2);opacity:0}39%{visibility:hidden}100%{visibility:hidden;opacity:0}}@-webkit-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@-moz-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@-o-keyframes headerIntro{0%{opacity:0}100%{opacity:1}}@keyframes headerIntro{0%{opacity:0}100%{opacity:1}}
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 134 KiB |
File diff suppressed because one or more lines are too long
@ -1,66 +1,148 @@
|
||||
var LocalStrategy = require('passport-local').Strategy;
|
||||
"use strict";
|
||||
|
||||
const LocalStrategy = require('passport-local').Strategy;
|
||||
const GoogleStrategy = require('passport-google-oauth20').Strategy;
|
||||
const WindowsLiveStrategy = require('passport-windowslive').Strategy;
|
||||
const FacebookStrategy = require('passport-facebook').Strategy;
|
||||
const _ = require('lodash');
|
||||
|
||||
module.exports = function(passport, appconfig) {
|
||||
|
||||
// Serialization user methods
|
||||
|
||||
passport.serializeUser(function(user, done) {
|
||||
done(null, user._id);
|
||||
});
|
||||
|
||||
passport.deserializeUser(function(id, done) {
|
||||
let user = db.User.find({ id });
|
||||
if(user) {
|
||||
done(null, user);
|
||||
} else {
|
||||
done(err, null);
|
||||
}
|
||||
});
|
||||
|
||||
// Setup local user authentication strategy
|
||||
|
||||
passport.use(
|
||||
'local',
|
||||
new LocalStrategy({
|
||||
usernameField : 'email',
|
||||
passwordField : 'password',
|
||||
passReqToCallback : true
|
||||
},
|
||||
function(req, uEmail, uPassword, done) {
|
||||
db.User.findOne({ 'email' : uEmail }).then((user) => {
|
||||
if (user) {
|
||||
user.validatePassword(uPassword).then((isValid) => {
|
||||
return (isValid) ? done(null, user) : done(null, false);
|
||||
});
|
||||
} else {
|
||||
return done(null, false);
|
||||
}
|
||||
}).catch((err) => {
|
||||
done(err);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
// Check for admin access
|
||||
|
||||
db.onReady.then(() => {
|
||||
|
||||
/*if(db.User.count() < 1) {
|
||||
winston.info('No administrator account found. Creating a new one...');
|
||||
if(db.User.insert({
|
||||
email: appconfig.admin,
|
||||
firstName: "Admin",
|
||||
lastName: "Admin",
|
||||
password: "admin123"
|
||||
})) {
|
||||
winston.info('Administrator account created successfully!');
|
||||
} else {
|
||||
winston.error('An error occured while creating administrator account: ');
|
||||
}
|
||||
}*/
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
// Serialization user methods
|
||||
|
||||
passport.serializeUser(function(user, done) {
|
||||
done(null, user._id);
|
||||
});
|
||||
|
||||
passport.deserializeUser(function(id, done) {
|
||||
db.User.findById(id).then((user) => {
|
||||
if(user) {
|
||||
done(null, user);
|
||||
} else {
|
||||
done(new Error('User not found.'), null);
|
||||
}
|
||||
return true;
|
||||
}).catch((err) => {
|
||||
done(err, null);
|
||||
});
|
||||
});
|
||||
|
||||
// Local Account
|
||||
|
||||
if(appconfig.auth.local && appconfig.auth.local.enabled) {
|
||||
|
||||
passport.use('local',
|
||||
new LocalStrategy({
|
||||
usernameField : 'email',
|
||||
passwordField : 'password',
|
||||
passReqToCallback : true
|
||||
},
|
||||
function(req, uEmail, uPassword, done) {
|
||||
db.User.findOne({ 'email' : uEmail }).then((user) => {
|
||||
if (user) {
|
||||
user.validatePassword(uPassword).then((isValid) => {
|
||||
return (isValid) ? done(null, user) : done(null, false);
|
||||
});
|
||||
} else {
|
||||
return done(null, false);
|
||||
}
|
||||
}).catch((err) => {
|
||||
done(err);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// Google ID
|
||||
|
||||
if(appconfig.auth.google && appconfig.auth.google.enabled) {
|
||||
|
||||
passport.use('google',
|
||||
new GoogleStrategy({
|
||||
clientID: appconfig.auth.google.clientId,
|
||||
clientSecret: appconfig.auth.google.clientSecret,
|
||||
callbackURL: appconfig.host + '/login/google/callback'
|
||||
},
|
||||
(accessToken, refreshToken, profile, cb) => {
|
||||
db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true;
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true;
|
||||
});
|
||||
}
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// Microsoft Accounts
|
||||
|
||||
if(appconfig.auth.microsoft && appconfig.auth.microsoft.enabled) {
|
||||
|
||||
passport.use('windowslive',
|
||||
new WindowsLiveStrategy({
|
||||
clientID: appconfig.auth.microsoft.clientId,
|
||||
clientSecret: appconfig.auth.microsoft.clientSecret,
|
||||
callbackURL: appconfig.host + '/login/ms/callback'
|
||||
},
|
||||
function(accessToken, refreshToken, profile, cb) {
|
||||
db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true;
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true;
|
||||
});
|
||||
}
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// Facebook
|
||||
|
||||
if(appconfig.auth.facebook && appconfig.auth.facebook.enabled) {
|
||||
|
||||
passport.use('facebook',
|
||||
new FacebookStrategy({
|
||||
clientID: appconfig.auth.facebook.clientId,
|
||||
clientSecret: appconfig.auth.facebook.clientSecret,
|
||||
callbackURL: appconfig.host + '/login/facebook/callback',
|
||||
profileFields: ['id', 'displayName', 'email']
|
||||
},
|
||||
function(accessToken, refreshToken, profile, cb) {
|
||||
db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true;
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true;
|
||||
});
|
||||
}
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// Check for admin access
|
||||
|
||||
db.onReady.then(() => {
|
||||
|
||||
db.User.count().then((c) => {
|
||||
if(c < 1) {
|
||||
winston.info('[' + PROCNAME + '][AUTH] No administrator account found. Creating a new one...');
|
||||
db.User.hashPassword('admin123').then((pwd) => {
|
||||
return db.User.create({
|
||||
provider: 'local',
|
||||
email: appconfig.admin,
|
||||
name: "Administrator",
|
||||
password: pwd
|
||||
});
|
||||
}).then(() => {
|
||||
winston.info('[' + PROCNAME + '][AUTH] Administrator account created successfully!');
|
||||
}).catch((err) => {
|
||||
winston.error('[' + PROCNAME + '][AUTH] An error occured while creating administrator account:');
|
||||
winston.error(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
};
|
Loading…
Reference in new issue