Added gender to user schema and radio buttons to account page
This commit is contained in:
@ -126,17 +126,15 @@ passport.use(new GoogleStrategy({
|
|||||||
if (existingUser) {
|
if (existingUser) {
|
||||||
return done(null, existingUser);
|
return done(null, existingUser);
|
||||||
}
|
}
|
||||||
|
console.log(profile);
|
||||||
var user = new User({
|
var user = new User({
|
||||||
name: profile.displayName,
|
google: profile.id
|
||||||
email: profile._json.email,
|
|
||||||
gender: profile._json.gender,
|
|
||||||
picture: profile._json.picture,
|
|
||||||
provider: profile.provider
|
|
||||||
});
|
});
|
||||||
|
|
||||||
user.tokens.google = accessToken;
|
user.tokens.google = accessToken;
|
||||||
user[profile.provider] = profile.id;
|
user.profile.name = profile.displayName;
|
||||||
|
user.profile.email = profile._json.email;
|
||||||
|
user.profile.gender = profile._json.gender;
|
||||||
|
user.profile.picture = profile._json.picture;
|
||||||
|
|
||||||
user.save(function(err) {
|
user.save(function(err) {
|
||||||
done(err, user);
|
done(err, user);
|
||||||
|
@ -18,6 +18,7 @@ var userSchema = new mongoose.Schema({
|
|||||||
profile: {
|
profile: {
|
||||||
name: { type: String, default: '' },
|
name: { type: String, default: '' },
|
||||||
email: { type: String, default: '' },
|
email: { type: String, default: '' },
|
||||||
|
gender: { type: String, default: '' },
|
||||||
location: { type: String, default: '' },
|
location: { type: String, default: '' },
|
||||||
website: { type: String, default: '' },
|
website: { type: String, default: '' },
|
||||||
picture: { type: String, default: '' }
|
picture: { type: String, default: '' }
|
||||||
|
@ -14,6 +14,15 @@ block content
|
|||||||
label.col-sm-2.control-label(for='name') Name
|
label.col-sm-2.control-label(for='name') Name
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
||||||
|
.form-group
|
||||||
|
label.col-sm-2.control-label(for='name') Gender
|
||||||
|
.col-sm-4
|
||||||
|
label.radio-inline
|
||||||
|
input(checked=user.profile.gender=='male', name='optionsRadios2', type='radio', value='option1')
|
||||||
|
span Male
|
||||||
|
label.radio-inline
|
||||||
|
input(checked=user.profile.gender=='female', name='optionsRadios2', type='radio', value='option2')
|
||||||
|
span Female
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-2.control-label(for='email') Email
|
label.col-sm-2.control-label(for='email') Email
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
|
@ -41,7 +41,7 @@ html
|
|||||||
a(href='/signup') Create Account
|
a(href='/signup') Create Account
|
||||||
else
|
else
|
||||||
li
|
li
|
||||||
a(href='/account') Welcome, #{user.firstName} #{user.lastName}
|
a(href='/account') #{user.profile.name}
|
||||||
li
|
li
|
||||||
a(href='/logout') Logout
|
a(href='/logout') Logout
|
||||||
.container
|
.container
|
||||||
|
Reference in New Issue
Block a user