不要怂,就是干,撸起袖子干!

Commit 2fad2ef5 by Sascha Depold

an authentication method

1 parent c5140be5
Showing with 16 additions and 0 deletions
...@@ -371,6 +371,22 @@ module.exports = (function() { ...@@ -371,6 +371,22 @@ module.exports = (function() {
}).run() }).run()
} }
Sequelize.prototype.authenticate = function() {
var self = this
return new Utils.CustomEventEmitter(function(emitter) {
self
.query('SELECT 1+1 AS result', null, { raw: true, plain: true })
.complete(function(err, result) {
if (!!err) {
emitter.emit('error', new Error('Invalid credentials.'))
} else {
emitter.emit('success')
}
})
}).run()
}
Sequelize.prototype.fn = function (fn) { Sequelize.prototype.fn = function (fn) {
return new Utils.fn(fn, Array.prototype.slice.call(arguments, 1)) return new Utils.fn(fn, Array.prototype.slice.call(arguments, 1))
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!