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;
    }