code: function(req, res, user) {
        waterlock.logger.debug('user registration success');
        if (!user) {
          waterlock.logger.debug('registerSuccess requires a valid user object');
          return res.serverError();
        }
  
        var address = this._addressFromRequest(req);
  
        var attempt = {
          user: user.id,
          successful: true
        };
  
        _.merge(attempt, address);
  
        waterlock.Attempt.create(attempt).exec(function(err) {
          if (err) {
            waterlock.logger.debug(err);
          }
        });
  
        // store user in && authenticate the session
        req.session.user = user;
        req.session.authenticated = true;
  
        // now respond or redirect
        var postResponse = this._resolvePostAction(waterlock.config.postActions.register.success, user);
  
        if (postResponse === 'jwt') {
          //Returns the token immediately
          var jwtData = waterlock._utils.createJwt(req, res, user);
  
          Jwt.create({token: jwtData.token, uses: 0, owner: user.id}).exec(function(err){
            if(err){
              return res.serverError('JSON web token could not be created');
            }
  
            var result = {};
  
            result[waterlock.config.jsonWebTokens.tokenProperty] = jwtData.token;
            result[waterlock.config.jsonWebTokens.expiresProperty] = jwtData.expires;
  
            if (waterlock.config.jsonWebTokens.includeUserInJwtResponse) {
              result['user'] = user;
            }
  
            res.json(result);
          });
        }else if (typeof postResponse === 'string' && this._isURI(postResponse)) {
          res.redirect(postResponse);
        } else {
          res.ok(postResponse);
        }
      }
docs: handles successful logins
  
  @param  {Object} req  express request object
  @param  {Object} res  expresss response object
  @param  {Object} user the user instance
  @api public