28 lines
725 B
PHP
28 lines
725 B
PHP
<?php
|
|
require_once "../../../bootstrap.php";
|
|
require_once "../Admin/Admin.php";
|
|
|
|
use \Backend\Models\Password;
|
|
|
|
//session_start();
|
|
if(isAdmin()){
|
|
if(isset($_POST['restPassword'])){
|
|
$password = Password::firstWhere("group_id",$_POST['groupId']);
|
|
if($password){
|
|
$password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
|
|
echo $password;
|
|
if(!$password->save()){
|
|
echo http_response_code(500);
|
|
}else{
|
|
echo http_response_code(201);
|
|
}
|
|
}else{
|
|
echo http_response_code(400);
|
|
}
|
|
|
|
}else{
|
|
echo http_response_code(400);
|
|
}
|
|
}else{
|
|
echo http_response_code(401);
|
|
} |