From 63527d2b995590af810ddb1b271d52f50c1f42b4 Mon Sep 17 00:00:00 2001 From: Kris Date: Mon, 15 Feb 2021 21:43:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Check=20if=20account=20has=20set?= =?UTF-8?q?=20an=20e-mail=20address=20before=20removing=20sso=20(#213)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Check if account has set an e-mail address before removing sso * Codacy * [Rollback] I don't know how to make Codacy happy here. * Language --- app/Http/Controllers/SocialController.php | 4 ++++ resources/lang/de/controller.php | 1 + resources/lang/en/controller.php | 1 + 3 files changed, 6 insertions(+) diff --git a/app/Http/Controllers/SocialController.php b/app/Http/Controllers/SocialController.php index 962700c1e..363c0faaf 100644 --- a/app/Http/Controllers/SocialController.php +++ b/app/Http/Controllers/SocialController.php @@ -188,6 +188,10 @@ public function destroyProvider(Request $request) { && !($user->socialProfile->twitter_id !== null && $user->socialProfile->mastodon_id !== null)) { return response(__('controller.social.delete-set-password'), 406); } + if ($user->email === null + && !($user->socialProfile->twitter_id !== null && $user->socialProfile->mastodon_id !== null)) { + return response(__('controller.social.delete-set-email'), 406); + } if ($user->socialProfile === null) { return response(__('controller.social.delete-never-connected'), 404); diff --git a/resources/lang/de/controller.php b/resources/lang/de/controller.php index a2dd33a4b..4e277ce4c 100644 --- a/resources/lang/de/controller.php +++ b/resources/lang/de/controller.php @@ -4,6 +4,7 @@ "already-connected-error" => "Dieser Account ist bereits mit einem anderen Nutzer verknüpft.", "create-error" => "Es gab ein Problem beim Erstellen Deines Accounts.", "delete-never-connected" => "Du hast keinen Social-Login-Provider.", + "delete-set-email" => "Bevor du einen SSO-Provider löschst, musst du eine E-Mail Adresse festlegen, um dich nicht auszusperren.", "delete-set-password" => "Bevor du einen SSO-Provider löschst, musst du ein Passwort festlegen, um dich nicht auszusperren.", "deleted" => "Die Verbindung wurde aufgehoben." ], diff --git a/resources/lang/en/controller.php b/resources/lang/en/controller.php index 0bf29179a..583cd80bf 100644 --- a/resources/lang/en/controller.php +++ b/resources/lang/en/controller.php @@ -4,6 +4,7 @@ "already-connected-error" => "This Account is already connected to another user", "create-error" => "There has been an error creating your account.", "delete-never-connected" => "Your user does not have a Social Login provider", + "delete-set-email" => "Before you delete an SSO provider, you need to set an email address so that you don't get locked out.", "delete-set-password" => "You need to set a password before deleting a SSO-Provider to prevent you from locking yourself out.", "deleted" => "Social Login Provider has been deleted" ],