Created
January 6, 2012 19:26
-
-
Save joshsmith/1572007 to your computer and use it in GitHub Desktop.
company.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Company = function() { | |
this.crypto = require('ezcrypto').Crypto; | |
} | |
// Create the company | |
Company.prototype.create = function (name, contact, email, password) { | |
result = this.hashPassword(password); | |
if (err) { | |
return callback(err); | |
} | |
return callback(null, result); | |
} | |
// Get company with just their email address | |
Company.prototype.hashPassword = function (password, callback) { | |
if(typeof password !== 'string') { | |
var err = 'Not a string.' | |
} else { | |
var result = { | |
password: this.crypto.SHA256(password) | |
}; | |
} | |
if (err) { | |
return callback(err); | |
} | |
return callback(null, result); | |
} | |
module.exports = Company; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment