feat(email): implement email change request and verification process
- Added functionality for users to request an email change, including generating a verification code and setting an expiration time. - Implemented methods in the User model to handle email change requests, code validation, and confirmation. - Created a new job to update the user's email in Stripe after confirmation. - Introduced rate limiting for email change requests and verification attempts to prevent abuse. - Added a new notification for email change verification. - Updated the profile component to manage email change requests and verification UI.
This commit is contained in:
@@ -89,3 +89,22 @@ function allowedPathsForInvalidAccounts()
|
||||
'livewire/update',
|
||||
];
|
||||
}
|
||||
|
||||
function updateStripeCustomerEmail(Team $team, string $newEmail): void
|
||||
{
|
||||
if (! isStripe()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$stripe_customer_id = data_get($team, 'subscription.stripe_customer_id');
|
||||
if (! $stripe_customer_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
Stripe::setApiKey(config('subscription.stripe_api_key'));
|
||||
|
||||
\Stripe\Customer::update(
|
||||
$stripe_customer_id,
|
||||
['email' => $newEmail]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user