209 lines
7.5 KiB
PHP
209 lines
7.5 KiB
PHP
<?php
|
|
$is_invalid = false;
|
|
// portal/admin/core/php/includes/include.php
|
|
// portal/admin/core/api/php/includes/include.php
|
|
require_once __DIR__ . "/core/api/php/includes/include.php";
|
|
|
|
$auth = InitDomainUserAuthObject();
|
|
$config = __get_managed_domain();
|
|
|
|
function new_login($_email,$_password,$auth,$config){
|
|
|
|
try {
|
|
$auth = InitMemberUserAuthObject();
|
|
if(filter_var($_email, FILTER_VALIDATE_EMAIL)) {
|
|
// valid address
|
|
$auth->login($_email, $_password);
|
|
}
|
|
else {
|
|
// invalid address
|
|
$auth->loginWithUsername($_email,$_password);
|
|
}
|
|
|
|
header("Location: " . $config["Address"] . "/portal/admin");
|
|
EchoJsonObject(["action" => "pass", "type" => 1]);
|
|
}
|
|
catch (\Delight\Auth\InvalidEmailException $e) {
|
|
EchoJsonObject(["action" => 'Wrong email address', "type" => 2]);
|
|
// die('Wrong email address');
|
|
}
|
|
catch (\Delight\Auth\InvalidPasswordException $e) {
|
|
EchoJsonObject(["action" => 'Wrong password', "type" => 3]);
|
|
// die('Wrong password');
|
|
}
|
|
catch (\Delight\Auth\EmailNotVerifiedException $e) {
|
|
EchoJsonObject(["action" => 'Email not verified', "type" => 4]);
|
|
// die('Email not verified');
|
|
}
|
|
catch (\Delight\Auth\TooManyRequestsException $e) {
|
|
EchoJsonObject(["action" => 'Too many requests', "type" => 5]);
|
|
// die('Too many requests');
|
|
}
|
|
catch (Exception $e){
|
|
EchoJsonObject(["action" => "email and password wrong", "type" => 6]);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(\Input::get("login")){
|
|
$username = $_POST["email"];
|
|
$password = $_POST["password"];
|
|
new_login($username,$password,$auth,$config);
|
|
die();
|
|
}
|
|
|
|
|
|
|
|
// echo json_encode($config);
|
|
|
|
// if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|
// $mysqli = func_get_database();
|
|
// $email_or_username = $mysqli->real_escape_string($_POST["email"]);
|
|
|
|
// $sql = sprintf("SELECT * FROM " . $GLOBALS["AUTH_USER_TABLE"] . " WHERE email = '%s' OR username = '%s'", $email_or_username, $email_or_username);
|
|
// $result = $mysqli->query($sql);
|
|
// $user = $result->fetch_assoc();
|
|
// // var_dump($user);
|
|
// if ($user) {
|
|
// if ($_POST["password"]==$user["password_hash"] || password_verify($_POST["password"], $user["password_hash"])) {
|
|
// session_start();
|
|
// session_regenerate_id();
|
|
// $_SESSION["user_id"] = $user["id"];
|
|
// header("Location: /portal/admin/");
|
|
// exit;
|
|
// }
|
|
// }
|
|
// $is_invalid = true;
|
|
// }
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title><?php echo $GLOBALS["SIGN_UP_TITLE"]; ?></title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<link rel="icon" type="image/x-icon" href="../../assets/favicon.ico">
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css">
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
|
|
|
<link href='https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css' rel='stylesheet'>
|
|
|
|
<script src="/portal/admin/core/api/js/appfactory/afsspinner.js"></script>
|
|
<script src="https://api-sandbox.appfactory.studio/sdk/js/afssdk-dev.js"></script>
|
|
<script src="/portal/admin/core/api/js/appfactory/afsextras.js"></script>
|
|
|
|
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"> -->
|
|
<!-- <script src="https://unpkg.com/just-validate@latest/dist/just-validate.production.min.js" defer></script> -->
|
|
|
|
|
|
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<div class="container-fluid mt-4">
|
|
<div class="row d-flex justify-content-center mt-4">
|
|
<div class="col-12 col-lg-3 mt-5">
|
|
<!-- <h3 class="d-flex justify-content-center">Cradle2Careertx</h3> -->
|
|
<!-- <div class="d-flex justify-content-center"><img src="../../../assets/c2c_stckd_pos_PMS.svg" height="75" alt="Cradle2Career" class=""></div> -->
|
|
<h3 class="d-flex justify-content-center">My Domain Portal</h3>
|
|
<h4 class="d-flex justify-content-center">Log In</h4>
|
|
<h6 class="d-flex justify-content-center"><?php echo $config["Subdomain"] . "." . $config["Domain"] ?></h6>
|
|
<!-- Email input -->
|
|
<form class="p-3" method="post">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" name="email" class="form-control" id="username" value="<?= htmlspecialchars($_POST["email"] ?? "") ?>">
|
|
<label class="form-label" for="form2Example1">Username</label>
|
|
</div>
|
|
|
|
<!-- Password input -->
|
|
<div class="form-outline mb-4">
|
|
<input type="password" name="password" class="form-control" id="password">
|
|
<label class="form-label" for="form2Example2">Password</label>
|
|
</div>
|
|
|
|
<!-- 2 column grid layout for inline styling -->
|
|
<div class="row mb-4">
|
|
<div class="col d-flex justify-content-center">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" value="" id="form2Example31" checked />
|
|
<label class="form-check-label" for="form2Example31"> Remember me </label>
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<a href="#" id="portal_forgot_password_id">Forgot password?</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Submit button -->
|
|
<div class="col-12 d-flex justify-content-end">
|
|
<button id="submit" class="btn btn-primary btn-block mb-4 ">Sign In</button>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="modal modal-blur fade" id="reset_password_modal" tabindex="-1" style="display: none;" aria-hidden="true">
|
|
<div class="modal-dialog modal-md modal-dialog-centered" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-body">
|
|
<div class="modal-title">Password Reset</div>
|
|
<div class="my-4">
|
|
<label class="form-label required">Email address</label>
|
|
<div>
|
|
<input id="email_password_reset_input" class="form-control" aria-describedby="emailHelp" placeholder="Enter email">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-link link-secondary me-auto" data-bs-dismiss="modal">Cancel</button>
|
|
<button id="modal_send_reset_request" class="btn btn-danger">Send Reset</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script data-main="/portal/admin/core/api/js/login_main" src="/portal/admin/core/api/js/libs/require.js"></script>
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|