snappymail/plugins/login-register/index.php

43 lines
1.3 KiB
PHP
Raw Normal View History

2021-05-31 22:19:01 +08:00
<?php
class LoginRegisterPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Register and Forgot',
2021-10-04 19:53:59 +08:00
VERSION = '2.1',
RELEASE = '2021-10-04',
2021-05-31 22:19:01 +08:00
REQUIRED = '2.5.2',
CATEGORY = 'Login',
DESCRIPTION = 'Links on login screen for registration and forgotten password';
2021-05-31 22:19:01 +08:00
public function Init() : void
{
$this->UseLangs(true);
$this->addJs('LoginRegister.js');
$this->addHook('filter.app-data', 'FilterAppData');
}
public function configMapping() : array
{
return [
\RainLoop\Plugins\Property::NewInstance("forgot_password_link_url")
// ->SetLabel('TAB_LOGIN/LABEL_FORGOT_PASSWORD_LINK_URL')
->SetLabel('Forgot password url')
->SetType(\RainLoop\Enumerations\PluginPropertyType::URL),
\RainLoop\Plugins\Property::NewInstance("registration_link_url")
// ->SetLabel('TAB_LOGIN/LABEL_REGISTRATION_LINK_URL')
->SetLabel('Register url')
->SetType(\RainLoop\Enumerations\PluginPropertyType::URL),
];
}
public function FilterAppData($bAdmin, &$aResult)
{
if (!$bAdmin && \is_array($aResult) && empty($aResult['Auth'])) {
$aResult['forgotPasswordLinkUrl'] = \trim($this->Config()->Get('plugin', 'forgot_password_link_url', ''));
$aResult['registrationLinkUrl'] = \trim($this->Config()->Get('plugin', 'registration_link_url', ''));
}
}
}