aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-16 00:12:14 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-16 00:12:14 +0200
commitec9a067313c3593834bc6b727429d028c43615eb (patch)
tree5db186605361593e3ad0643b5a70def9d7b0b487
parentfixed regressionerror (diff)
downloadDivid-ec9a067313c3593834bc6b727429d028c43615eb.tar.gz
just some small changes
-rw-r--r--models/User.js18
-rw-r--r--views/navbar.ejs2
-rw-r--r--views/signup.ejs16
3 files changed, 21 insertions, 15 deletions
diff --git a/models/User.js b/models/User.js
index 216b8b0..01a6694 100644
--- a/models/User.js
+++ b/models/User.js
@@ -30,7 +30,9 @@ var UserSchema = new Schema({
facebook: {},
twitter: {},
status: { type: Number, default: 2 },
- randomToken: String
+ randomToken: String,
+ created: { type: Date, default: Date.now },
+ updated: { type: Date, default: Date.now }
});
@@ -86,10 +88,9 @@ UserSchema.path('hashed_password').validate(function(hashed_password) {
UserSchema.pre('save', function(next) {
if (!this.isNew || this.status === 1) return next();
- if(!validatePrecenceOf(this.password)
- && authTypes.indexOf(this.provider) === -1)
- next(new Error('Invalid password'));
- else next();
+ this.updated = Date.now();
+ next();
+
});
@@ -142,14 +143,15 @@ UserSchema.methods = {
* Generate random access token for Remember Me function
*
* @param {Number} length
+ * @param {Boolean} noDate
* @return {String}
* @api public
*/
- generateRandomToken: function(length) {
- if (typeof(length) === 'undefined') length = 16; // default length of token
+ generateRandomToken: function(length, noDate) {
+ if (typeof(length) === undefined) length = 16; // default length of token
var chars = '_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
- , token = new Date().getTime() + '_';
+ , token = noDate ? '' : new Date().getTime() + '_';
for (var i = 0; i < length; i++) {
var x = Math.floor(Math.random() * chars.length);
token += chars.charAt(x);
diff --git a/views/navbar.ejs b/views/navbar.ejs
index 12d3e26..785c2bf 100644
--- a/views/navbar.ejs
+++ b/views/navbar.ejs
@@ -14,7 +14,7 @@
<div class="control-group">
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope icon-white"></i></span>
- <input type="text" name="email" id="email" placeholder="E-post" required>
+ <input type="email" name="email" id="email" placeholder="E-post" required>
</div>
</div>
<div class="control-group">
diff --git a/views/signup.ejs b/views/signup.ejs
index 01a5831..c058402 100644
--- a/views/signup.ejs
+++ b/views/signup.ejs
@@ -19,7 +19,11 @@
<div id="email-cg" class="control-group">
<label for="email-tf" class="control-label">Email</label>
<div class="controls">
- <input id="email-tf" type="text" name="email" class="input-xlarge">
+ <% if (invite) { %>
+ <span class="input uneditable-input"><%= email %></span>
+ <% } else { %>
+ <input id="email-tf" type="text" name="email" class="input-xlarge">
+ <% } %>
</div>
</div>
<hr>
@@ -57,11 +61,11 @@
<button data-dismiss="modal" class="btn btn-warning">OK</button>
</div>
</div>
-
-
-
-
-
+
+
+
+
+
<div class="modal-alert modal hide fade">
<div class="modal-header">
<button data-dismiss="modal" class="close">x</button>