v0.1.5bc Try to fix user update with empty text box
This commit is contained in:
parent
7c5345ac8a
commit
59f91682a7
|
@ -6,9 +6,16 @@ use Backend\Model\User;
|
|||
|
||||
if(isset($_POST['id'])){
|
||||
$user = User::query()->find($_POST['id']);
|
||||
$user->name = $_POST['upName'];
|
||||
$newPass = password_hash($_POST['upPassword'], PASSWORD_DEFAULT);
|
||||
$user->password = $newPass;
|
||||
|
||||
|
||||
if(!empty($_POST['upName'])){
|
||||
$user->name = $_POST['upName'];
|
||||
}
|
||||
|
||||
if(!empty($_POST['upPassword'])){
|
||||
$newPass = password_hash($_POST['upPassword'], PASSWORD_DEFAULT);
|
||||
$user->password = $newPass;
|
||||
}
|
||||
|
||||
if($user->update()){
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue