Skip to content

Commit

Permalink
🩹 Check if account has set an e-mail address before removing sso (#213)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MrKrisKrisu authored Feb 15, 2021
1 parent bec1eb6 commit 63527d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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."
],
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down

0 comments on commit 63527d2

Please sign in to comment.