Your IP : 216.73.216.86


Current Path : /home/emeraadmin/public_html/4d695/
Upload File :
Current File : /home/emeraadmin/public_html/4d695/reset-password.php.tar

home/emeraadmin/public_html/pages/reset-password.php000064400000011467151677420450016716 0ustar00<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Reset Password | Emera Facility Services</title>
    <link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800" rel="stylesheet">
    <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../dist/css/theme.min.css">
    <style>
        .auth-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .lavalite-bg {
            background-size: cover;
            background-position: center;
            height: 100%;
        }

        .center-image {
            display: block;
            margin: 0 auto;
        }

        .authentication-form {
            width: 100%;
            max-width: 400px;
            padding: 30px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .sign-btn .btn-theme {
            width: 100%;
        }

        .register {
            text-align: center;
            margin-top: 20px;
        }
    </style>
</head>

<body>
<div class="auth-wrapper">
    <div class="container-fluid h-100">
        <div class="row flex-row h-100 bg-white">
            <div class="col-xl-4 col-lg-6 col-md-7 my-auto p-0 mx-auto">
                <div class="authentication-form mx-auto">
                    <a href="login.php"><img src="../src/img/Emera-Primary-Logo.png" alt="Emera Logo" style="height: 100px; align-items: center; display: block; margin-left: auto; margin-right: auto;"></a>
                    <br>

                    <p class="text-center">Enter your new password</p>
                    <form method="post" name="reset-password" id="reset-password">
                        <div class="form-group">
                            <input type="password" class="form-control" name="new-password" placeholder="New Password" required>
                        </div>
                        <div class="form-group">
                            <input type="password" class="form-control" name="confirm-password" placeholder="Confirm Password" required>
                        </div>
                        <input type="hidden" name="token" value="<?php echo $_GET['token']; ?>">
                        <div class="sign-btn text-center">
                            <button class="btn btn-theme" type="submit">Reset Password</button>
                        </div>
                        <div id="reset-password-error" class="alert alert-danger d-none mt-3"></div>
                        <div id="reset-password-success" class="alert alert-success d-none mt-3"></div>
                    </form>
                    <div class="register">
                        <p>Remembered? <a href="../login.php">Sign In</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

<script>
    $(document).ready(function(){
        $("#reset-password").submit(function(e){
            e.preventDefault();
            var newPassword = $("input[name='new-password']").val();
            var confirmPassword = $("input[name='confirm-password']").val();
            var token = $("input[name='token']").val();

            if (newPassword !== confirmPassword) {
                $("#reset-password-error").text("Passwords do not match").removeClass("d-none");
                return;
            }

            $.ajax({
                url: 'update_password.php',
                type: 'POST',
                data: {token: token, new_password: newPassword},
                success: function(response){
                    if (response.includes("Password updated")) {
                        Swal.fire({
                            title: 'Password Reset Successful!',
                            text: response,
                            icon: 'success',
                            confirmButtonText: 'OK'
                        }).then(() => {
                            window.location.href = "login.php";
                        });
                    } else {
                        $("#reset-password-error").text(response).removeClass("d-none");
                    }
                },
                error: function(){
                    $("#reset-password-error").text("An error occurred. Please try again.").removeClass("d-none");
                }
            });
        });
    });
</script>

</body>
</html>