Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Kaimeeting #8

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 16 additions & 30 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var passport = require('passport');
var LocalStrategy = require('passport-local');
var mongoose = require('mongoose');
var connect = process.env.MONGODB_URI;

var FacebookStrategy = require('passport-facebook');
var REQUIRED_ENV = "SECRET MONGODB_URI".split(" ");

REQUIRED_ENV.forEach(function(el) {
Expand All @@ -19,11 +19,8 @@ REQUIRED_ENV.forEach(function(el) {
}
});


mongoose.connect(connect);

var models = require('./models');

var routes = require('./routes/routes');
var auth = require('./routes/auth');
var app = express();
Expand All @@ -49,41 +46,30 @@ app.use(session({
store: new MongoStore({ mongooseConnection: mongoose.connection })
}));

passport.use(new FacebookStrategy({
clientID: process.env.FACEBOOK_APP_ID,
clientSecret: process.env.FACEBOOK_APP_SECRET,
callbackURL: 'http://localhost:3000/facebook/login/callback'
},
function(accessToken, refreshToken, profile, done){
done(null, {
token: accessToken,
name: profile.displayName,
id: profile.id
});
}));

app.use(passport.initialize());
app.use(passport.session());

passport.serializeUser(function(user, done) {
done(null, user._id);
done(null, user);
});

passport.deserializeUser(function(id, done) {
models.User.findById(id, done);
passport.deserializeUser(function(user, done) {
done(null, user);
});

// passport strategy
passport.use(new LocalStrategy(function(username, password, done) {
// Find the user with the given username
models.User.findOne({ username: username }, function (err, user) {
// if there's an error, finish trying to authenticate (auth failed)
if (err) {
console.error('Error fetching user in LocalStrategy', err);
return done(err);
}
// if no user present, auth failed
if (!user) {
return done(null, false, { message: 'Incorrect username.' });
}
// if passwords do not match, auth failed
if (user.password !== password) {
return done(null, false, { message: 'Incorrect password.' });
}
// auth has has succeeded
return done(null, user);
});
}
));

app.use('/', auth(passport));
app.use('/', routes);

Expand Down
Binary file added public/images/1.0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/fallabove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/fog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hedge.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hedgefall.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/ice.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/images.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/wint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/scripts/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
// YOUR JS CODE FOR ALL PAGES GOES HERE
$(document).ready(function () {
$(window).on('load scroll', function () {
var scrolled = $(this).scrollTop();
$('#title').css({
'transform': 'translate3d(0, ' + -(scrolled * 0.2) + 'px, 0)', // parallax (20% scroll rate)
'opacity': 1 - scrolled / 400 // fade out at 400px from top
});
$('#hero-vid').css('transform', 'translate3d(0, ' + -(scrolled * 0.25) + 'px, 0)'); // parallax (25% scroll rate)
});

// video controls
$('#state').on('click', function () {
var video = $('#hero-vid').get(0);
var icons = $('#state > span');
$('#overlay').toggleClass('fade');
if (video.paused) {
video.play();
icons.removeClass('fa-play').addClass('fa-pause');
} else {
video.pause();
icons.removeClass('fa-pause').addClass('fa-play');
}
});
});
Loading