registry.js
function loginUser(name, pass, cb) {
  // Get the user
  var db = nano().use(user_dbname)
  db.get(user_namespace+':'+name, function(err, doc) {
    if(err) return cb(err)
    
    // Check pass
    var hash = crypto.createHash('sha1')
    hash.update(pass)
    hash.update(doc.salt)
    var password_sha = hash.digest('hex')
    if(doc.password_sha === password_sha) {
      return cb(null, doc)
    }
    
    cb(new Error('Access denied.'))
  })
}
function loginUser(name, pass, cb) {
  // Get the user
  var db = nano().use(user_dbname)
  db.get(user_namespace+':'+name, function(err, doc) {
    if(err) return cb(err)
    
    // Check pass
    var hash = crypto.createHash('sha1')
    hash.update(pass)
    hash.update(doc.salt)
    var password_sha = hash.digest('hex')
    if(doc.password_sha === password_sha) {
      return cb(null, doc)
    }
    
    cb(new Error('Access denied.'))
  })
}
function loginUser ( name , pass , cb ) { // Get the user var db = nano ( ) . use ( user_dbname ) db . get ( user_namespace + ':' + name , function ( err , doc ) { if ( err ) return cb ( err ) // Check pass var hash = crypto . createHash ( 'sha1' ) hash . update ( pass ) hash . update ( doc . salt ) var password_sha = hash . digest ( 'hex' ) if ( doc . password_sha === password_sha ) { return cb ( null , doc ) } cb ( new Error ( 'Access denied.' ) ) } ) }
Checks loginUser credenciales
Checks loginUser credenciales