diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/default/functions.php b/default/functions.php new file mode 100644 index 0000000..05fd49f --- /dev/null +++ b/default/functions.php @@ -0,0 +1,17 @@ +getFiles()->addStylesheet('global', $this->url('css/global.css'), '1.0.0', [ 'bootstrap' ]); + $this->getFiles()->addJavascript('global', $this->url('js/global.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER); + $this->getFiles()->addJavascript('ajax', $this->url('js/ajax.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER); + + if(!Auth::isLoggedIn()) { + $this->getFiles()->addStylesheet('login', $this->url('css/login.css'), '2.0.0', [ 'bootstrap' ]); + $this->getFiles()->addJavascript('login', $this->url('js/login.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER); + } else { + $this->getFiles()->addStylesheet('style', $this->url('css/style.css'), '2.0.0', [ 'bootstrap' ]); + $this->getFiles()->addJavascript('ui', $this->url('js/ui.js'), '2.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER); + $this->getFiles()->addJavascript('codemirror', $this->url('js/codemirror/build/bundle.min.js'), '6.0.0', [ 'ui' ], TemplateFiles::FOOTER); + } +?> \ No newline at end of file diff --git a/handler/settings/default.php b/handler/settings/default.php new file mode 100644 index 0000000..8664887 --- /dev/null +++ b/handler/settings/default.php @@ -0,0 +1,20 @@ +getCore()->getHooks()->runAction('SAVE_ACCOUNT_SETTINGS_GLOBAL', $_POST); + $template->assign('success', I18N::get('Your settings has been updated.')); + I18N::reload(); +?> \ No newline at end of file diff --git a/handler/settings/security.php b/handler/settings/security.php new file mode 100644 index 0000000..fe4023b --- /dev/null +++ b/handler/settings/security.php @@ -0,0 +1,48 @@ +getCore()->getHooks()->applyFilter('2FA_METHODS', [ + (object) [ + 'id' => 'mail', + 'name' => I18N::get('E-Mail'), + 'enabled' => true + ] + ]) AS $index => $method) { + if($method->id == $_POST['2fa_type']) { + $selected = $method; + break; + } + } + + if($selected == null) { + $template->assign('error', I18N::get('The selected 2FA method is not known.')); + return; + } + + if(!$selected->enabled) { + $template->assign('error', sprintf(I18N::get('The 2FA method "%s" is currently deactivated and can therefore not be used.'), $selected->name)); + return; + } + + if(isset($_POST['2fa_enabled'])) { + Auth::setSettings('2FA_ENABLED', NULL, 'true'); + } else { + Auth::setSettings('2FA_ENABLED', NULL, 'false'); + } + + Auth::setSettings('2FA_TYPE', NULL, $_POST['2fa_type']); + + $template->getCore()->getHooks()->runAction('SAVE_ACCOUNT_SETTINGS_SECURITY', $_POST); + $template->assign('success', I18N::get('Your security settings has been updated.')); + ?> \ No newline at end of file