Skip to content

Commit

Permalink
fix(users): Check prop has value before parsing
Browse files Browse the repository at this point in the history
Cannot pass `null` to `preg_match()`
  • Loading branch information
zooley committed Apr 3, 2024
1 parent a6155d5 commit 561e7a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Modules/Users/Resources/views/site/account.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,36 +145,36 @@
<select class="form-control property-edit" id="INPUT_loginshell" data-prop="loginshell">
<?php
$selected = '';
if (preg_match("/bash$/", $user->loginShell)):
if ($user->loginShell && preg_match("/bash$/", $user->loginShell)):
$selected = ' selected="selected"';
endif;
?>
<option value="/bin/bash"<?php echo $selected; ?>>bash</option>
<?php
$selected = '';
if (preg_match("/\/csh$/", $user->loginShell)):
if ($user->loginShell && preg_match("/\/csh$/", $user->loginShell)):
$selected = ' selected="selected"';
endif;
?>
<option value="/bin/csh"<?php echo $selected; ?>>csh</option>
<?php
$selected = '';
if (preg_match("/tcsh$/", $user->loginShell)):
if ($user->loginShell && preg_match("/tcsh$/", $user->loginShell)):
$selected = ' selected="selected"';
endif;
?>
<option value="/bin/tcsh"<?php echo $selected; ?>>tcsh</option>
<?php
$selected = '';
if (preg_match("/zsh$/", $user->loginShell)):
if ($user->loginShell && preg_match("/zsh$/", $user->loginShell)):
$selected = ' selected="selected"';
endif;
?>
<option value="/bin/zsh"<?php echo $selected; ?>>zsh</option>
@if (auth()->user()->can('manage users'))
<?php
$selected = '';
if (preg_match("/nologin$/", $user->loginShell)):
if ($user->loginShell && preg_match("/nologin$/", $user->loginShell)):
$selected = ' selected="selected"';
endif;
?>
Expand Down

0 comments on commit 561e7a4

Please sign in to comment.