Guest User

Untitled

a guest
Sep 21st, 2017
1,742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. // Check login and return object
  2. checkLogin: function(username, password) {
  3. ProfileObj = Profile.find({username: username, password: password}).one(function(err, profile){
  4. return profile;
  5. });
  6.  
  7. console.log(ProfileObj);
  8. return ProfileObj;
  9. }
  10.  
  11. profile = req.models.profile();
  12. ProfileObj = profile.checkLogin('test', 'test');
  13.  
  14. { find: [Function],
  15. only: [Function],
  16. limit: [Function],
  17. skip: [Function],
  18. offset: [Function],
  19. order: [Function],
  20. orderRaw: [Function],
  21. count: [Function],
  22. remove: [Function],
  23. first: [Function],
  24. last: [Function],
  25. each: [Function],
  26. run: [Function],
  27. success: [Function],
  28. fail: [Function],
  29. all: [Function],
  30. where: [Function],
  31. one: [Function],
  32. beforeCreate: [Function],
  33. afterCreate: [Function],
  34. beforeSave: [Function],
  35. afterSave: [Function],
  36. beforeValidation: [Function],
  37. beforeRemove: [Function],
  38. afterRemove: [Function],
  39. afterLoad: [Function],
  40. afterAutoFetch: [Function],
  41. extendsTo: [Function],
  42. model:
  43. { [Function]
  44. allProperties:
  45. { username: [Object],
  46. name: [Object],
  47. email: [Object],
  48. password: [Object],
  49. id: [Object] },
  50. settings: { set: [Function], get: [Function], unset: [Function] },
  51. drop: [Function],
  52. sync: [Function],
  53. get: [Function],
  54. find: [Function],
  55. all: [Function],
  56. one: [Function],
  57. count: [Function],
  58. aggregate: [Function],
  59. exists: [Function],
  60. create: [Function],
  61. clear: [Function],
  62. beforeCreate: [Function],
  63. afterCreate: [Function],
  64. beforeSave: [Function],
  65. afterSave: [Function],
  66. beforeValidation: [Function],
  67. beforeRemove: [Function],
  68. afterRemove: [Function],
  69. afterLoad: [Function],
  70. afterAutoFetch: [Function],
  71. hasOne: [Function],
  72. hasMany: [Function],
  73. extendsTo: [Function] },
  74. options:
  75. { only: [ 'id', 'username', 'name', 'email', 'password' ],
  76. id: [ 'id' ],
  77. table: 'profile',
  78. driver:
  79. { config: [Object],
  80. opts: [Object],
  81. customTypes: {},
  82. query: [Object],
  83. db: [Object],
  84. aggregate_functions: [Object],
  85. uid: '2d7089091970609caded514e621b51a7' },
  86. conditions: { username: 'test', password: 'test' },
  87. associations: [],
  88. limit: undefined,
  89. order: null,
  90. merge: null,
  91. offset: undefined,
  92. newInstance: [Function] } }
  93.  
  94. models.profile = db.define('profile', {
  95. id: { type: 'serial', key: true },
  96. another_column: { type: 'text' }
  97. }, {
  98. methods: {
  99. checkLogin: function (username, password) {
  100. models.profile.one({ username, password }, (err, user) => {
  101. return user;
  102. });
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment