Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var models = require('wilson/models');
exports.User = models.model({
'username':models.CharField({'max_length':255}),
'first_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'last_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'email':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'password':models.CharField({'max_length':40}),
'is_staff':models.BooleanField(),
'is_active':models.BooleanField(),
'is_superuser':models.BooleanField(),
'last_login':models.DateTimeField(),
'date_joined':models.DateTimeField(),
'toString':function() {
return this.username;
},
'isAnonymous':function() {
return false;
},
'isAuthenticated':function() {
return true;
},
'getFullName':function() {
var models = require('wilson/models');
exports.User = models.model({
'username':models.CharField({'max_length':255}),
'first_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'last_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'email':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'password':models.CharField({'max_length':40}),
'is_staff':models.BooleanField(),
'is_active':models.BooleanField(),
'is_superuser':models.BooleanField(),
'last_login':models.DateTimeField(),
'date_joined':models.DateTimeField(),
'toString':function() {
return this.username;
},
'isAnonymous':function() {
return false;
},
'isAuthenticated':function() {
return true;
},
'getFullName':function() {
return [this.first_name, this.last_name].join(' ').replace('^\s*','').replace('\s*$','');
var models = require('wilson/models');
exports.User = models.model({
'username':models.CharField({'max_length':255}),
'first_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'last_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'email':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'password':models.CharField({'max_length':40}),
'is_staff':models.BooleanField(),
'is_active':models.BooleanField(),
'is_superuser':models.BooleanField(),
'last_login':models.DateTimeField(),
'date_joined':models.DateTimeField(),
'toString':function() {
return this.username;
},
'isAnonymous':function() {
return false;
},
'isAuthenticated':function() {
return true;
},
var models = require('wilson/models'),
settings = require('wilson/conf').settings,
Buffer = require('buffer').Buffer,
crypto = require('crypto');
exports.Session = models.model({
'session_key':models.CharField({'max_length':40, primary_key:true}),
'session_data':models.TextField(),
'expire_date':models.DateTimeField(),
'get_encoded':function(data) {
var pickled = JSON.stringify(data),
md5 = crypto.createHash('md5').update(pickled + settings.SECRET_KEY).digest('hex'),
result = new Buffer(pickled + md5, 'utf8').toString('base64');
return result;
},
'get_decoded':function() {
var encodedData = (new Buffer(this.session_data, 'base64')).toString('utf8'),
pickled = encodedData.slice(0, -32),
tamperCheck = encodedData.slice(-32),
md5sum = crypto.createHash('md5').update(pickled + settings.SECRET_KEY).digest('hex');
if(md5sum !== tamperCheck) {
throw new Error("User tampered with session cookie.");
} else {
var models = require('wilson/models');
exports.User = models.model({
'username':models.CharField({'max_length':255}),
'first_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'last_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'email':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'password':models.CharField({'max_length':40}),
'is_staff':models.BooleanField(),
'is_active':models.BooleanField(),
'is_superuser':models.BooleanField(),
'last_login':models.DateTimeField(),
'date_joined':models.DateTimeField(),
'toString':function() {
return this.username;
},
'isAnonymous':function() {
return false;
},
'isAuthenticated':function() {
return true;
var models = require('wilson/models');
exports.User = models.model({
'username':models.CharField({'max_length':255}),
'first_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'last_name':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'email':models.CharField({'max_length':255, 'nullable':true, 'blank':true}),
'password':models.CharField({'max_length':40}),
'is_staff':models.BooleanField(),
'is_active':models.BooleanField(),
'is_superuser':models.BooleanField(),
'last_login':models.DateTimeField(),
'date_joined':models.DateTimeField(),
'toString':function() {
return this.username;
},
'isAnonymous':function() {
return false;
},
'isAuthenticated':function() {