Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check login and return object
- checkLogin: function(username, password) {
- ProfileObj = Profile.find({username: username, password: password}).one(function(err, profile){
- return profile;
- });
- console.log(ProfileObj);
- return ProfileObj;
- }
- profile = req.models.profile();
- ProfileObj = profile.checkLogin('test', 'test');
- { find: [Function],
- only: [Function],
- limit: [Function],
- skip: [Function],
- offset: [Function],
- order: [Function],
- orderRaw: [Function],
- count: [Function],
- remove: [Function],
- first: [Function],
- last: [Function],
- each: [Function],
- run: [Function],
- success: [Function],
- fail: [Function],
- all: [Function],
- where: [Function],
- one: [Function],
- beforeCreate: [Function],
- afterCreate: [Function],
- beforeSave: [Function],
- afterSave: [Function],
- beforeValidation: [Function],
- beforeRemove: [Function],
- afterRemove: [Function],
- afterLoad: [Function],
- afterAutoFetch: [Function],
- extendsTo: [Function],
- model:
- { [Function]
- allProperties:
- { username: [Object],
- name: [Object],
- email: [Object],
- password: [Object],
- id: [Object] },
- settings: { set: [Function], get: [Function], unset: [Function] },
- drop: [Function],
- sync: [Function],
- get: [Function],
- find: [Function],
- all: [Function],
- one: [Function],
- count: [Function],
- aggregate: [Function],
- exists: [Function],
- create: [Function],
- clear: [Function],
- beforeCreate: [Function],
- afterCreate: [Function],
- beforeSave: [Function],
- afterSave: [Function],
- beforeValidation: [Function],
- beforeRemove: [Function],
- afterRemove: [Function],
- afterLoad: [Function],
- afterAutoFetch: [Function],
- hasOne: [Function],
- hasMany: [Function],
- extendsTo: [Function] },
- options:
- { only: [ 'id', 'username', 'name', 'email', 'password' ],
- id: [ 'id' ],
- table: 'profile',
- driver:
- { config: [Object],
- opts: [Object],
- customTypes: {},
- query: [Object],
- db: [Object],
- aggregate_functions: [Object],
- uid: '2d7089091970609caded514e621b51a7' },
- conditions: { username: 'test', password: 'test' },
- associations: [],
- limit: undefined,
- order: null,
- merge: null,
- offset: undefined,
- newInstance: [Function] } }
- models.profile = db.define('profile', {
- id: { type: 'serial', key: true },
- another_column: { type: 'text' }
- }, {
- methods: {
- checkLogin: function (username, password) {
- models.profile.one({ username, password }, (err, user) => {
- return user;
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment