user.js
function checkemail(next) {
      if (user.email) {
        userent.load$({ email: user.email }, function(err, userfound) {
          if (err) return done(err, { ok: false, user: user })
          if (userfound)
            return done(null, {
              ok: false,
              why: 'email-exists',
              nick: args.nick
            })
          next()
        })
        return
      }
      next()
    }
function checkemail(next) {
      if (user.email) {
        userent.load$({ email: user.email }, function(err, userfound) {
          if (err) return done(err, { ok: false, user: user })
          if (userfound)
            return done(null, {
              ok: false,
              why: 'email-exists',
              nick: args.nick
            })
          next()
        })
        return
      }
      next()
    }
function checkemail ( next ) { if ( user . email ) { userent . load$ ( { email : user . email } , function ( err , userfound ) { if ( err ) return done ( err , { ok : false , user : user } ) if ( userfound ) return done ( null , { ok : false , why : 'email-exists' , nick : args . nick } ) next ( ) } ) return } next ( ) }
unsafe email unique check, data store should also enforce !!
unsafe email unique check data store should also enforce !!