Fix FLEXIAPI-401 Use a Space scoped reset password URL

This commit is contained in:
Timothée Jaussoin 2025-10-13 14:31:48 +02:00
parent 92978bf256
commit 5082654d01
2 changed files with 13 additions and 1 deletions

View file

@ -266,6 +266,18 @@ class Account extends Authenticatable
return $this->hasMany(AuthToken::class);
}
/**
* Reset password
*/
public function getCurrentResetPasswordUrlAttribute(): string
{
return replaceHost(
route('account.reset_password_email.change', $this->currentResetPasswordEmailToken->token),
$this->space->host
);
}
public function currentResetPasswordEmailToken()
{
return $this->hasOne(ResetPasswordEmailToken::class)->where('used', false)->latestOfMany();

View file

@ -9,7 +9,7 @@
{{ __('Click the button below to choose a new password:') }}
[{{ __('Reset my password') }}]({{ route('account.reset_password_email.change', $account->currentResetPasswordEmailToken->token) }})
[{{ __('Reset my password') }}]({{ $account->currentResetPasswordUrl }})
{{ __('This link will expire in :hour hours.', ['hour' => config('app.reset_password_email_token_expiration_minutes')/60 ]) }}