Guest User

Untitled

a guest
Jun 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. function Person() {
  2.  
  3. // properties and validations
  4. this.attr(
  5. { id: Number, unique: true, nullable: false },
  6. { email: String, unique: true, nullable: false, min: 1, max: 55, format: '[a-b]' },
  7. { salt: String },
  8. { pswd: String },
  9. { active: Boolean, init: false },
  10. { tags: Array }
  11. );
  12.  
  13. // helpful property declarations
  14. this.timestamp();
  15.  
  16. // callbacks
  17. this.creating({ before: poundSalt, after: emailActivationCode });
  18. this.updating();
  19. this.deleting();
  20.  
  21. // a private function to generate a unique salt for hashing the password, called in 'creating' callback
  22. // testable therefore by the creating callback?
  23. function poundSalt(obj) {
  24.  
  25. }
  26.  
  27. // emails an activation code
  28. function emailActivationCode(obj) {
  29.  
  30. }
  31.  
  32.  
  33. function forgotPassword(obj) {
  34.  
  35. }
  36.  
  37. // views, beautiful custom finders
  38. this.view('tags', { map: function () {}, reduce: function () {} });
  39. this.view('popular');
  40.  
  41. // public instance attributes
  42. return {
  43. // activates the user account
  44. get active() {
  45.  
  46. },
  47. set active() {
  48.  
  49. };
  50. }
Add Comment
Please, Sign In to add comment