UseLangs(true); $this->addJs('hibp.js'); $this->addJsonHook('HibpCheck'); } public function HibpCheck() { // $oAccount = $this->Manager()->Actions()->GetAccount(); $oAccount = $this->Manager()->Actions()->getAccountFromToken(); // $oAccount = \RainLoop\Api::Actions()->getAccountFromToken(); $api_key = \trim($this->Config()->Get('plugin', 'hibp-api-key', '')); $breaches = $api_key ? Hibp::account($api_key, $oAccount->Email()) : null; $pwned = Hibp::password(new SensitiveString($oAccount->ImapPass())); return $this->jsonResponse(__FUNCTION__, array( 'pwned' => $pwned, 'breaches' => $breaches )); } public function configMapping() : array { return [ \RainLoop\Plugins\Property::NewInstance("hibp-api-key") ->SetLabel('API key') ->SetDescription('https://haveibeenpwned.com/API/Key') ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING) ]; } }