Permalink
Browse files

All done

  • Loading branch information...
1 parent 44980f4 commit 29ebc00ee9f6ace0f222e8699bd38eaa857e38f9 @Hitman666 committed Jan 14, 2015
@@ -14,7 +14,7 @@ var UserSchema = new Schema({
provider: String,
providerId: String,
providerData: {},
- todos: {}
+ todos: {}//we will use this in the next tutorial to store TODOs
});
UserSchema.pre('save',
@@ -57,9 +57,4 @@ UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
);
};
-// UserSchema.set('toJSON', {
-// getters: true,
-// virtuals: true
-// });
-
mongoose.model('User', UserSchema);
@@ -34,11 +34,11 @@ module.exports = function(app) {
}));
app.get('/oauth/twitter', passport.authenticate('twitter', {
- failureRedirect: '/signin'
+ failureRedirect: '/login'
}));
app.get('/oauth/twitter/callback', passport.authenticate('twitter', {
- failureRedirect: '/signin',
+ failureRedirect: '/login',
successRedirect: '/'
}));
};
View
@@ -19,11 +19,11 @@
<form class="form-signin" action="/login" method="post">
<h2 class="form-signin-heading text-center">Open, says me</h2>
- <label for="inputUsername" class="sr-only">Username</label>
- <input type="email" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
+ <label for="username" class="sr-only">Username</label>
+ <input type="text" name="username" id="username" class="form-control" placeholder="Username" required autofocus>
- <label for="inputPassword" class="sr-only">Password</label>
- <input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
+ <label for="password" class="sr-only">Password</label>
+ <input type="password" name="password" id="password" class="form-control" placeholder="Password">
<button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
</form>
@@ -17,17 +17,27 @@
<form class="form-signin" action="/register" method="post">
<h2 class="form-signin-heading text-center">Register</h2>
- <label for="name" class="sr-only">Username</label>
+ <label for="username" class="sr-only">Username</label>
+ <input type="text" id="username" name="username" class="form-control" placeholder="Username" required autofocus>
+
+ <label for="name" class="sr-only">Name</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Name" required autofocus>
<label for="email" class="sr-only">E-mail</label>
<input type="email" id="email" name="email" class="form-control" placeholder="E-mail" required>
<label for="password" class="sr-only">Password</label>
- <input type="password" id="password" class="form-control" placeholder="Password" required>
+ <input type="password" name="password" id="password" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
</form>
+
+ <div class="row">
+ <div class="center-block text-center">
+ <a href="/oauth/facebook">Login with Facebook</a> |
+ <a href="/oauth/twitter">Login with Twitter</a>
+ </div>
+ </div>
</div>
</body>
</html>
@@ -6,11 +6,11 @@ module.exports = {
facebook: {
clientID: '513828288756645',
clientSecret: '2d7cc991efddb864e9af61f307980b9a',
- callbackURL: 'http://localhost:1337/oauth/facebook/callback'
+ callbackURL: 'http://localhost:'+ port +'/oauth/facebook/callback'
},
twitter: {
clientID: 'yFntGKkvMZkDKL47XGtzLNdRA',
clientSecret: 'EAiPTjPYLX5nrkpRtxYQflbWpRTqqLwwBHRLh7WpdQ1P69Tre6',
- callbackURL: 'http://localhost:1337/oauth/twitter/callback'
+ callbackURL: 'http://localhost:'+ port +'/oauth/twitter/callback'
}
};
@@ -16,7 +16,7 @@ module.exports = function() {
providerData.token = token;
providerData.tokenSecret = tokenSecret;
var providerUserProfile = {
- fullName: profile.displayName,
+ name: profile.displayName,
username: profile.username,
provider: 'twitter',
providerId: profile.id,

0 comments on commit 29ebc00

Please sign in to comment.