mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Notify user if email address is changed
This commit is contained in:
parent
a9faea4054
commit
e423475195
@ -46,6 +46,8 @@ class HandleUserSettingsChanged
|
|||||||
|
|
||||||
if ($event->user && $event->user->isEmailBeingChanged()) {
|
if ($event->user && $event->user->isEmailBeingChanged()) {
|
||||||
$this->userMailer->sendConfirmation($event->user);
|
$this->userMailer->sendConfirmation($event->user);
|
||||||
|
$this->userMailer->sendEmailChanged($event->user);
|
||||||
|
|
||||||
Session::flash('warning', trans('texts.verify_email'));
|
Session::flash('warning', trans('texts.verify_email'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,9 +319,7 @@ class User extends Authenticatable
|
|||||||
*/
|
*/
|
||||||
public function isEmailBeingChanged()
|
public function isEmailBeingChanged()
|
||||||
{
|
{
|
||||||
return Utils::isNinjaProd()
|
return Utils::isNinjaProd() && $this->email != $this->getOriginal('email');
|
||||||
&& $this->email != $this->getOriginal('email')
|
|
||||||
&& $this->getOriginal('confirmed');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,6 +38,31 @@ class UserMailer extends Mailer
|
|||||||
$this->sendTo($user->email, $fromEmail, $fromName, $subject, $view, $data);
|
$this->sendTo($user->email, $fromEmail, $fromName, $subject, $view, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param User|null $invitor
|
||||||
|
*/
|
||||||
|
public function sendEmailChanged(User $user)
|
||||||
|
{
|
||||||
|
$oldEmail = $user->getOriginal('email');
|
||||||
|
$newEmail = $user->email;
|
||||||
|
|
||||||
|
if (! $oldEmail || ! $newEmail) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$view = 'user_message';
|
||||||
|
$subject = trans('texts.email_address_changed');
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'user' => $user,
|
||||||
|
'userName' => $user->getDisplayName(),
|
||||||
|
'primaryMessage' => trans('texts.email_address_changed_message', ['old_email' => $oldEmail, 'new_email' => $newEmail]),
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->sendTo($oldEmail, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param Invoice $invoice
|
* @param Invoice $invoice
|
||||||
|
@ -2742,6 +2742,8 @@ $LANG = array(
|
|||||||
'change_requires_purge' => 'Changing this setting requires :link the account data.',
|
'change_requires_purge' => 'Changing this setting requires :link the account data.',
|
||||||
'purging' => 'purging',
|
'purging' => 'purging',
|
||||||
'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.',
|
'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.',
|
||||||
|
'email_address_changed' => 'Email address has been changed',
|
||||||
|
'email_address_changed_message' => 'The email address for your account has been changed from :old_email to :new_email.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user