I want to let the logged in user update his or her email by a form submission in the front-end. But unfortunately the email address does not change. This is my controller:
If I submit the form, I get no exception, and after reload the email returned by $kirby->user()->email() is kirby@getkirby.com. After another reload, the returned value is the old email address from before the change.
Does anybody see the problem in my code or know where the problem may be?
Oh, yes, thank you for pointing that out! But after deleting the line in my code, the email address still does not get updated. Do you see anything else problematic?
Does get('submit-mail-change)` actually return anything, i.e. does the submit input actually have a value? I have a feeling that your code never goes past the if-statement. Try if it works without the second condition or make sure the submit input actually has a value.
Yes, good point, but also after removing the second condition, it does not change the behaviour.
But I tried changing the URL in the second if clause go($page->url());, but submitting the form still reloads the same page. So there has to be something wrong.
Okay, as always, the error was very simple…
The name of my controller was wrong, I mixed up snippet and template names.
So sorry for wasting your time! But still thank you for helping, since your questioning of the controller even pointed me to double-checking it again.