diff --git a/config/routes.php b/config/routes.php index e51df17a..14a5e1a9 100644 --- a/config/routes.php +++ b/config/routes.php @@ -20,6 +20,8 @@ $route->post('/oauth/{provider:\w+}/connect', 'OAuthController@connect'); $route->post('/oauth/{provider:\w+}/disconnect', 'OAuthController@disconnect'); // User settings +$route->get('/settings/password', 'SettingsController@password'); +$route->post('/settings/password', 'SettingsController@savePassword'); $route->get('/settings/oauth', 'SettingsController@oauth'); // Password recovery diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index f2ddabe2..f5b4ddff 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -101,31 +101,6 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes) return $user_source; } -/** - * Change user password. - * - * @param User $user_source The user - */ -function user_settings_password($user_source) -{ - $request = request(); - $auth = auth(); - if ( - !$request->has('password') - || !$auth->verifyPassword($user_source, $request->postData('password')) - ) { - error(__('-> not OK. Please try again.')); - } elseif (strlen($request->postData('new_password')) < config('min_password_length')) { - error(__('Your password is to short (please use at least 6 characters).')); - } elseif ($request->postData('new_password') != $request->postData('new_password2')) { - error(__('Your passwords don\'t match.')); - } else { - $auth->setPassword($user_source, $request->postData('new_password')); - success(__('Password saved.')); - } - throw_redirect(page_link_to('user_settings')); -} - /** * Change user theme * @@ -216,8 +191,6 @@ function user_settings() $user_source = auth()->user(); if ($request->hasPostData('submit')) { $user_source = user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes); - } elseif ($request->hasPostData('submit_password')) { - user_settings_password($user_source); } elseif ($request->hasPostData('submit_theme')) { $user_source = user_settings_theme($user_source, $themes); } elseif ($request->hasPostData('submit_language')) { diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 34f6ec2d..3568806e 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -107,13 +107,6 @@ function User_settings_view( . button(url('/settings/oauth'), __('settings.oauth'), 'btn-primary') : '' ), - form([ - form_info(__('Here you can change your password.')), - form_password('password', __('Old password:')), - form_password('new_password', __('New password:')), - form_password('new_password2', __('Password confirmation:')), - form_submit('submit_password', __('Save')) - ]), form([ form_info(__('Here you can choose your color settings:')), form_select('theme', __('Color settings:'), $themes, $user_source->settings->theme), diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po index c3d383d5..244890a6 100644 --- a/resources/lang/de_DE/additional.po +++ b/resources/lang/de_DE/additional.po @@ -102,3 +102,6 @@ msgstr "Account nicht gefunden" msgid "oauth.provider-not-found" msgstr "OAuth-Provider nicht gefunden" + +msgid "settings.profile" +msgstr "Profil" diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 17623360..c52f954d 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -2915,8 +2915,14 @@ msgstr "Nachricht" msgid "settings.settings" msgstr "Einstellungen" +msgid "settings.password" +msgstr "Passwort" + msgid "settings.oauth" -msgstr "OAuth Einstellungen" +msgstr "Single-Sign-On" + +msgid "settings.oauth.identity-provider" +msgstr "Login-Dienst" msgid "oauth.login" msgstr "Login mit OAuth" diff --git a/resources/lang/en_US/additional.po b/resources/lang/en_US/additional.po index fbdb0f34..592ac050 100644 --- a/resources/lang/en_US/additional.po +++ b/resources/lang/en_US/additional.po @@ -98,3 +98,6 @@ msgstr "Unable to find account" msgid "oauth.provider-not-found" msgstr "Unable to find OAuth provider" + +msgid "settings.profile" +msgstr "Profile" diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index e6d39720..1f81e974 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -181,8 +181,14 @@ msgstr "Message" msgid "settings.settings" msgstr "Settings" +msgid "settings.password" +msgstr "Password" + msgid "settings.oauth" -msgstr "OAuth Settings" +msgstr "Single-Sign-On" + +msgid "settings.oauth.identity-provider" +msgstr "Identity provider" msgid "oauth.login" msgstr "Login using OAuth" diff --git a/resources/views/macros/form.twig b/resources/views/macros/form.twig index 07db74ad..f85b4f38 100644 --- a/resources/views/macros/form.twig +++ b/resources/views/macros/form.twig @@ -65,7 +65,7 @@ {%- endmacro %} {% macro button(label, opt) %} -