Skip to content

Firefly III: a personal finances manager

Fix issue with email change.

James Coledf8a406c5819
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 4271ca5efe..1f6c466f4e 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -152,7 +152,7 @@ class ProfileController extends Controller
}
$repository->unblockUser($user);
// also remove the "remote_guard_alt_email" preference.
- Preferences::delete('remote_guard_alt_email');
+ Preferences::deleteForUser($user, 'remote_guard_alt_email');
// return to log in.
session()->flash('success', (string) trans('firefly.login_with_new_email'));
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 267c5e79a2..062b15f490 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -75,6 +75,17 @@ class Preferences
return true;
}
+ public function deleteForUser(User $user, string $name): bool
+ {
+ $fullName = sprintf('preference%s%s', auth()->user()->id, $name);
+ if (Cache::has($fullName)) {
+ Cache::forget($fullName);
+ }
+ Preference::where('user_id', $user->id)->where('name', $name)->delete();
+
+ return true;
+ }
+
/**
* Find by name, has no user ID in it, because the method is called from an unauthenticated route any way.
*/
diff --git a/changelog.md b/changelog.md
index 32cb8563da..478d0addf5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #11614
- #11620
- #11632
+- Confirming your new email address would result in an error.
### Security