mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Resolve Issue #93
This commit is contained in:
parent
5a6c012b60
commit
d67cfaa3a4
13 changed files with 169 additions and 6 deletions
|
|
@ -145,6 +145,8 @@ function buildViewModel(ViewModelClass, vmScreen) {
|
||||||
if (vm && ViewType.Popup === position) {
|
if (vm && ViewType.Popup === position) {
|
||||||
vm.registerPopupKeyDown();
|
vm.registerPopupKeyDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatchEvent(new CustomEvent('rl-view-model', {detail:vm}));
|
||||||
} else {
|
} else {
|
||||||
console.log('Cannot find view model position: ' + position);
|
console.log('Cannot find view model position: ' + position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
plugins/login-register/LoginRegister.js
Normal file
33
plugins/login-register/LoginRegister.js
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
(rl => {
|
||||||
|
if (rl) {
|
||||||
|
const
|
||||||
|
forgotUrl = rl.settings.get('forgotPasswordLinkUrl'),
|
||||||
|
registerUrl = rl.settings.get('registrationLinkUrl');
|
||||||
|
|
||||||
|
if (forgotUrl || registerUrl) {
|
||||||
|
addEventListener('rl-view-model', e => {
|
||||||
|
if (e.detail && 'Login' === e.detail.viewModelTemplateID) {
|
||||||
|
const container = e.detail.viewModelDom.querySelector('#plugin-Login-BottomControlGroup'),
|
||||||
|
forgot = 'LOGIN/LABEL_FORGOT_PASSWORD',
|
||||||
|
register = 'LOGIN/LABEL_REGISTRATION';
|
||||||
|
if (container) {
|
||||||
|
let html = '';
|
||||||
|
if (forgotUrl) {
|
||||||
|
html = html + '<p class="forgot-link">'
|
||||||
|
+ '<a href="'+forgotUrl+'" target="_blank" class="g-ui-link" data-i18n="'+forgot+'">'+rl.i18n(forgot)+'</a>'
|
||||||
|
+ '</p>';
|
||||||
|
}
|
||||||
|
if (registerUrl) {
|
||||||
|
html = html + '<p class="registration-link">'
|
||||||
|
+ '<a href="'+registerUrl+'" target="_blank" class="g-ui-link" data-i18n="'+register+'">'+rl.i18n(register)+'</a>'
|
||||||
|
+ '</p>';
|
||||||
|
}
|
||||||
|
container.append(Element.fromHTML('<div class="controls clearfix">' + html + '</div>'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})(window.rl);
|
||||||
42
plugins/login-register/index.php
Normal file
42
plugins/login-register/index.php
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class LoginRegisterPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
{
|
||||||
|
const
|
||||||
|
NAME = 'Register and Forgot',
|
||||||
|
VERSION = '2.0',
|
||||||
|
RELEASE = '2021-06-01',
|
||||||
|
REQUIRED = '2.5.2',
|
||||||
|
CATEGORY = 'Login',
|
||||||
|
DESCRIPTION = 'Links on login screen for registration and forgot password';
|
||||||
|
|
||||||
|
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', ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/de-DE.json
Normal file
10
plugins/login-register/langs/de-DE.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Passwort vergessen",
|
||||||
|
"LABEL_REGISTRATION": "Registrieren"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/en.json
Normal file
10
plugins/login-register/langs/en.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Forgot password",
|
||||||
|
"LABEL_REGISTRATION": "Register"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/es-ES.json
Normal file
10
plugins/login-register/langs/es-ES.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Olvidé mi contraseña",
|
||||||
|
"LABEL_REGISTRATION": "Registrarse"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/fr-FR.json
Normal file
10
plugins/login-register/langs/fr-FR.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Mot de passe oublié",
|
||||||
|
"LABEL_REGISTRATION": "S'enregistrer"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/hu-HU.json
Normal file
10
plugins/login-register/langs/hu-HU.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Elfelejtett jelszó",
|
||||||
|
"LABEL_REGISTRATION": "Regisztráció"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/nl-NL.json
Normal file
10
plugins/login-register/langs/nl-NL.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Wachtwoord vergeten",
|
||||||
|
"LABEL_REGISTRATION": "Registreren"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/sv-SE.json
Normal file
10
plugins/login-register/langs/sv-SE.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "Glömt lösenord",
|
||||||
|
"LABEL_REGISTRATION": "Registrera"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
plugins/login-register/langs/zh-CN.json
Normal file
10
plugins/login-register/langs/zh-CN.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD": "忘记密码",
|
||||||
|
"LABEL_REGISTRATION": "注册"
|
||||||
|
},
|
||||||
|
"TAB_LOGIN": {
|
||||||
|
"LABEL_FORGOT_PASSWORD_LINK_URL": "Forgot password url",
|
||||||
|
"LABEL_REGISTRATION_LINK_URL": "Register url"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,10 +4,12 @@ namespace RainLoop\Enumerations;
|
||||||
|
|
||||||
class PluginPropertyType
|
class PluginPropertyType
|
||||||
{
|
{
|
||||||
const STRING = 0;
|
const
|
||||||
const INT = 1;
|
STRING = 0,
|
||||||
const STRING_TEXT = 2;
|
INT = 1,
|
||||||
const PASSWORD = 3;
|
STRING_TEXT = 2,
|
||||||
const SELECTION = 4;
|
PASSWORD = 3,
|
||||||
const BOOL = 5;
|
SELECTION = 4,
|
||||||
|
BOOL = 5,
|
||||||
|
URL = 6;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@
|
||||||
params: { value: value, label: Label }
|
params: { value: value, label: Label }
|
||||||
}"></div>
|
}"></div>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
<!-- ko if: 6 === Type -->
|
||||||
|
<input type="url"
|
||||||
|
data-bind="value: value, attr: {placeholder: placeholder}" />
|
||||||
|
<!-- /ko -->
|
||||||
<span class="help-block" data-bind="text: Desc, visible: '' !== Desc"></span>
|
<span class="help-block" data-bind="text: Desc, visible: '' !== Desc"></span>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue