start writing validations
parent
1accb225c6
commit
ec5fea2eaa
|
@ -158,7 +158,7 @@ exports.postUpdateProfile = function(req, res, next) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
user.email = req.body.email || '';
|
user.email = req.body.email || '';
|
||||||
user.profile.name = req.body.name || '';
|
user.profile.name = req.body.name || '';
|
||||||
user.profile.gender = req.body.gender || '';
|
user.profile.username = req.body.username || '';
|
||||||
user.profile.location = req.body.location || '';
|
user.profile.location = req.body.location || '';
|
||||||
user.profile.website = req.body.website || '';
|
user.profile.website = req.body.website || '';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ var crypto = require('crypto');
|
||||||
var mongoose = require('mongoose');
|
var mongoose = require('mongoose');
|
||||||
|
|
||||||
var userSchema = new mongoose.Schema({
|
var userSchema = new mongoose.Schema({
|
||||||
email: { type: String, unique: true, lowercase: true },
|
email: { type: String, unique: true, lowercase: true, match: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/ },
|
||||||
password: String,
|
password: String,
|
||||||
|
|
||||||
facebook: String,
|
facebook: String,
|
||||||
|
@ -21,7 +21,7 @@ var userSchema = new mongoose.Schema({
|
||||||
location: { type: String, default: '' },
|
location: { type: String, default: '' },
|
||||||
website: { type: String, default: '' },
|
website: { type: String, default: '' },
|
||||||
picture: { type: String, default: '' },
|
picture: { type: String, default: '' },
|
||||||
username: { type: String, default: '' }
|
username: { type: String, default: '', unique: true, match: /^[a-zA-Z0-9_]+$/ }
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPasswordToken: String,
|
resetPasswordToken: String,
|
||||||
|
|
|
@ -7,14 +7,18 @@ block content
|
||||||
.animated.flipInX
|
.animated.flipInX
|
||||||
form.form-horizontal(action='/account/profile', method='POST')
|
form.form-horizontal(action='/account/profile', method='POST')
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
.form-group
|
|
||||||
label.col-sm-2.control-label(for='email') Email
|
|
||||||
.col-sm-4
|
|
||||||
input.form-control(type='email', name='email', id='email', value='#{user.email}')
|
|
||||||
.form-group
|
.form-group
|
||||||
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='username') Username
|
||||||
|
.col-sm-4
|
||||||
|
input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
|
||||||
|
.form-group
|
||||||
|
label.col-sm-2.control-label(for='email') Email
|
||||||
|
.col-sm-4
|
||||||
|
input.form-control(type='email', name='email', id='email', value='#{user.email}')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-2.control-label(for='location') Location
|
label.col-sm-2.control-label(for='location') Location
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
|
|
Loading…
Reference in New Issue