Game-Jaming/Backend/Controllers/Group/UpdatePassword.php

24 lines
732 B
PHP

<?php
require_once "../../../bootstrap.php";
require_once "Group.php";
use Backend\Models\Password;
if(isLogin()){
if(isset($_POST['updatePassword'])){
$password = Password::firstWhere("group_id", groupViaToken($_SESSION["token"])->id);
if(passwordValidate($pass = $_POST['password'])){
$password->password = password_hash($pass,PASSWORD_DEFAULT);
$password->save();
header("location: ../../../Frontend/index.html?success=PasswordUpdated");
exit();
}
}else{
header("location: ../../../Frontend/index.html?error=CouldNotUpdated");
exit();
}
}else{
header("location: ../../../Frontend/index.html?error=NotLogin");
exit();
}