mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Merge pull request #11492 from mikeroq/fixes/email_all_assigned_to_user_with_no_email
Fixes "email list of all assigned" apparently being successful even if the user has no email address
This commit is contained in:
commit
bb5ac900ec
|
@ -628,14 +628,16 @@ class UsersController extends Controller
|
||||||
{
|
{
|
||||||
$this->authorize('view', User::class);
|
$this->authorize('view', User::class);
|
||||||
|
|
||||||
if( User::where('id', $id)->first()->exists())
|
if (!$user = User::find($id)) {
|
||||||
{
|
return redirect()->back()
|
||||||
$user= User::where('id', $id)->first();
|
->with('error', trans('admin/users/message.user_not_found', ['id' => $id]));
|
||||||
$user->notify((new CurrentInventory($user)));
|
}
|
||||||
return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
|
if (empty($user->email)) {
|
||||||
|
return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with('error', 'admin/accessories/message.user_does_not_exist');
|
$user->notify((new CurrentInventory($user)));
|
||||||
|
return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@ return array(
|
||||||
'ldap_not_configured' => 'LDAP integration has not been configured for this installation.',
|
'ldap_not_configured' => 'LDAP integration has not been configured for this installation.',
|
||||||
'password_resets_sent' => 'The selected users who are activated and have a valid email addresses have been sent a password reset link.',
|
'password_resets_sent' => 'The selected users who are activated and have a valid email addresses have been sent a password reset link.',
|
||||||
'password_reset_sent' => 'A password reset link has been sent to :email!',
|
'password_reset_sent' => 'A password reset link has been sent to :email!',
|
||||||
|
'user_has_no_email' => 'This user does not have an email address in their profile.',
|
||||||
|
|
||||||
|
|
||||||
'success' => array(
|
'success' => array(
|
||||||
|
|
|
@ -185,10 +185,14 @@
|
||||||
|
|
||||||
@can('view', $user)
|
@can('view', $user)
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
@if(!empty($user->email))
|
||||||
<form action="{{ route('users.email',['userId'=> $user->id]) }}" method="POST">
|
<form action="{{ route('users.email',['userId'=> $user->id]) }}" method="POST">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button>
|
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button>
|
||||||
</form>
|
</form>
|
||||||
|
@else
|
||||||
|
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener" disabled title="{{ trans('admin/users/message.user_has_no_email') }}">{{ trans('admin/users/general.email_assigned') }}</button>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue