Is there a way to allow users to edit their email address via a front-end form in Craft 3?
My understanding is this would require an 'elevated' user session. Which I'm guessing can only be achieved via plugin. In the API docs I see that there is a startElevatedSession() method.
At a minimum, I'm assuming this might work:
- Submit form with existing password and new email to a custom controller.
- Controller starts an elevated session via
startElevatedSession(), sets new password on user, saves user, and redirects to success page.
If I were to create a 'confirm email' workflow for security — how might that work? Can I tap into the Craft native workflow? Or would it all need to be custom?
FYI... in this case, the site is set to
useEmailAsUsername if that makes a difference.
As a follow-up, would changing the email address affect relationships to commerce orders? I assume that they are related by something other than just email address.
Any general pointers would be much appreciated. Thanks.