diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 7918123b..5abe0421 100644 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -37,6 +37,9 @@ $plugins = array( 'loginBodyBegin'=>array(), 'loginBodyEnd'=>array(), + 'beforeVerifyUser'=>array(), + 'afterVerifyUser'=>array(), + 'all'=>array() ); diff --git a/bl-kernel/login.class.php b/bl-kernel/login.class.php index 5b92bada..72747192 100644 --- a/bl-kernel/login.class.php +++ b/bl-kernel/login.class.php @@ -104,6 +104,13 @@ class Login { return false; } + try { + Theme::plugins('beforeVerifyUser'); + } catch (Exception $e) { + Log::set($e->getFile().LOG_SEP.$e->getLine().LOG_SEP.$e->getMessage()); + return false; + } + try { $user = new User($username); } catch (Exception $e) { @@ -117,7 +124,17 @@ class Login { return true; } - Log::set(__METHOD__.LOG_SEP.'Password incorrect.'); + try { + Theme::plugins('afterVerifyUser'); + } catch (Exception $e) { + Log::set($e->getFile().LOG_SEP.$e->getLine().LOG_SEP.$e->getMessage()); + return false; + } + if ($this->isLogged()) { + return true; + } + + Log::set(__METHOD__.LOG_SEP.'Password incorrect.'); return false; } @@ -171,4 +188,4 @@ class Login { Session::destroy(); return true; } -} \ No newline at end of file +} diff --git a/bl-plugins/imap-authentication/languages/de.json b/bl-plugins/imap-authentication/languages/de.json new file mode 100644 index 00000000..b5218a2c --- /dev/null +++ b/bl-plugins/imap-authentication/languages/de.json @@ -0,0 +1,8 @@ +{ + "plugin-data": + { + "name": "IMAP-Authentifizierung", + "description": "Dieses Plugin ermöglicht die Authentifizierung von Benutzern mit Hilfe eines IMAP-Servers.", + "imap-server": "IMAP Server" + } +} diff --git a/bl-plugins/imap-authentication/languages/en.json b/bl-plugins/imap-authentication/languages/en.json new file mode 100644 index 00000000..7225dba2 --- /dev/null +++ b/bl-plugins/imap-authentication/languages/en.json @@ -0,0 +1,8 @@ +{ + "plugin-data": + { + "name": "IMAP Authentication", + "description": "This plugin enables the authentication of users, using an IMAP server.", + "imap-server": "IMAP Server" + } +} diff --git a/bl-plugins/imap-authentication/metadata.json b/bl-plugins/imap-authentication/metadata.json new file mode 100644 index 00000000..90994528 --- /dev/null +++ b/bl-plugins/imap-authentication/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "LeineLab", + "email": "", + "website": "https://leinelab.org", + "version": "0.1.0", + "releaseDate": "2020-06-15", + "license": "MIT", + "compatible": "3.12.0", + "notes": "" +} diff --git a/bl-plugins/imap-authentication/plugin.php b/bl-plugins/imap-authentication/plugin.php new file mode 100644 index 00000000..dce7d5d6 --- /dev/null +++ b/bl-plugins/imap-authentication/plugin.php @@ -0,0 +1,137 @@ +dbFields = array( + self::IMAP_SERVER_DB_FIELD=>'', + ); + } + + public function form() + { + global $L; + + $html = '