original_string: public function login(HTTPRequest $request)
      {
          $response = array();
  
          if ($this->tokenConfig['owner'] === Member::class) {
              $email = $request->requestVar('email');
              $pwd = $request->requestVar('pwd');
              $member = false;
  
              if ($email && $pwd) {
                  $member = Injector::inst()->get(MemberAuthenticator::class)->authenticate(
                      array(
                          'Email' => $email,
                          'Password' => $pwd,
                      ),
                      $request
                  );
                  if ($member) {
                      $tokenData = $this->generateToken();
  
                      $tokenDBColumn = $this->tokenConfig['DBColumn'];
                      $expireDBColumn = $this->tokenConfig['expireDBColumn'];
  
                      $member->{$tokenDBColumn} = $tokenData['token'];
                      $member->{$expireDBColumn} = $tokenData['expire'];
                      $member->write();
                      $member->login();
                  }
              }
  
              if (!$member) {
                  $response['result'] = false;
                  $response['message'] = 'Authentication fail.';
                  $response['code'] = self::AUTH_CODE_LOGIN_FAIL;
              } else {
                  $response['result'] = true;
                  $response['message'] = 'Logged in.';
                  $response['code'] = self::AUTH_CODE_LOGGED_IN;
                  $response['token'] = $tokenData['token'];
                  $response['expire'] = $tokenData['expire'];
                  $response['userID'] = $member->ID;
              }
          }
  
          return $response;
      }
code: public function login(HTTPRequest $request)
      {
          $response = array();
  
          if ($this->tokenConfig['owner'] === Member::class) {
              $email = $request->requestVar('email');
              $pwd = $request->requestVar('pwd');
              $member = false;
  
              if ($email && $pwd) {
                  $member = Injector::inst()->get(MemberAuthenticator::class)->authenticate(
                      array(
                          'Email' => $email,
                          'Password' => $pwd,
                      ),
                      $request
                  );
                  if ($member) {
                      $tokenData = $this->generateToken();
  
                      $tokenDBColumn = $this->tokenConfig['DBColumn'];
                      $expireDBColumn = $this->tokenConfig['expireDBColumn'];
  
                      $member->{$tokenDBColumn} = $tokenData['token'];
                      $member->{$expireDBColumn} = $tokenData['expire'];
                      $member->write();
                      $member->login();
                  }
              }
  
              if (!$member) {
                  $response['result'] = false;
                  $response['message'] = 'Authentication fail.';
                  $response['code'] = self::AUTH_CODE_LOGIN_FAIL;
              } else {
                  $response['result'] = true;
                  $response['message'] = 'Logged in.';
                  $response['code'] = self::AUTH_CODE_LOGGED_IN;
                  $response['token'] = $tokenData['token'];
                  $response['expire'] = $tokenData['expire'];
                  $response['userID'] = $member->ID;
              }
          }
  
          return $response;
      }
code_tokens: public function login ( HTTPRequest $ request ) { $ response = array ( ) ; if ( $ this -> tokenConfig [ 'owner' ] === Member :: class ) { $ email = $ request -> requestVar ( 'email' ) ; $ pwd = $ request -> requestVar ( 'pwd' ) ; $ member = false ; if ( $ email && $ pwd ) { $ member = Injector :: inst ( ) -> get ( MemberAuthenticator :: class ) -> authenticate ( array ( 'Email' => $ email , 'Password' => $ pwd , ) , $ request ) ; if ( $ member ) { $ tokenData = $ this -> generateToken ( ) ; $ tokenDBColumn = $ this -> tokenConfig [ 'DBColumn' ] ; $ expireDBColumn = $ this -> tokenConfig [ 'expireDBColumn' ] ; $ member -> { $ tokenDBColumn } = $ tokenData [ 'token' ] ; $ member -> { $ expireDBColumn } = $ tokenData [ 'expire' ] ; $ member -> write ( ) ; $ member -> login ( ) ; } } if ( ! $ member ) { $ response [ 'result' ] = false ; $ response [ 'message' ] = 'Authentication fail.' ; $ response [ 'code' ] = self :: AUTH_CODE_LOGIN_FAIL ; } else { $ response [ 'result' ] = true ; $ response [ 'message' ] = 'Logged in.' ; $ response [ 'code' ] = self :: AUTH_CODE_LOGGED_IN ; $ response [ 'token' ] = $ tokenData [ 'token' ] ; $ response [ 'expire' ] = $ tokenData [ 'expire' ] ; $ response [ 'userID' ] = $ member -> ID ; } } return $ response ; }
docstring: Login a user into the Framework and generates API token
  Only works if the token owner is a Member
  
  @param  HTTPRequest   $request  HTTP request containing 'email' & 'pwd' vars
  @return array                      login result with token
docstring_tokens: Login a user into the Framework and generates API token Only works if the token owner is a Member