Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Person() {
- // properties and validations
- this.attr(
- { id: Number, unique: true, nullable: false },
- { email: String, unique: true, nullable: false, min: 1, max: 55, format: '[a-b]' },
- { salt: String },
- { pswd: String },
- { active: Boolean, init: false },
- { tags: Array }
- );
- // helpful property declarations
- this.timestamp();
- // callbacks
- this.creating({ before: poundSalt, after: emailActivationCode });
- this.updating();
- this.deleting();
- // a private function to generate a unique salt for hashing the password, called in 'creating' callback
- // testable therefore by the creating callback?
- function poundSalt(obj) {
- }
- // emails an activation code
- function emailActivationCode(obj) {
- }
- function forgotPassword(obj) {
- }
- // views, beautiful custom finders
- this.view('tags', { map: function () {}, reduce: function () {} });
- this.view('popular');
- // public instance attributes
- return {
- // activates the user account
- get active() {
- },
- set active() {
- };
- }
Add Comment
Please, Sign In to add comment