Compare commits

...

3 Commits

4 changed files with 54 additions and 2 deletions

42
forgotpassword.html Normal file
View File

@@ -0,0 +1,42 @@
<?php
session_start();
if (isset($_SESSION['user'])) {
header("Location: https://glink.zip/");
exit();
}
?>
<!DOCTYPE html>
<html lang="en" class="h-full bg-white">
<head>
<link rel="stylesheet" href="output.css">
<title>Forgot Password - GLink</title>
</head>
<body class="h-full mx-[10%]">
<div class="flex min-h-full flex-col px-6 pt-24 lg:px-8">
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
<img class="mx-auto h-10 w-auto" src="GLink-Logo-alt.svg" alt="GLink Logo">
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">Forgot your Password?</h2>
<br>
<p>Enter your email address below, and we will send you a link to reset your password.</p>
</div>
<div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
<form class="space-y-6" action="forgotpassword.php" method="POST">
<div>
<label for="email" class="block text-sm font-medium leading-6 text-gray-900">Email address</label>
<div class="mt-2">
<input id="email" name="email" type="email" autocomplete="email" required class="px-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
<div id="email-error" class="hidden mt-2 text-red-800 text-xs">
Invalid Email
</div>
</div>
</div>
<button type="submit" class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Send link</button>
</div>
</form>
</div>
</div>
<script src="login.js"></script>
</body>
</html>

10
forgotpassword.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
session_start();
require_once 'db.inc.php';
$email = $_POST['email'];
$session = init_cass_db();
// Create a hash of the email and the timestamp, and send an email with a link that contains the hash as a GET variable.
?>

View File

@@ -5,7 +5,7 @@ session_start();
<html id="html-tag" lang="en" class="py-[0%] my-[0%]"> <html id="html-tag" lang="en" class="py-[0%] my-[0%]">
<head class="py-0 my-0 h-0"> <head class="py-0 my-0 h-0">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>GLink</title> <title>GLink - A Geo-Restricted Link Shortener</title>
<link rel="stylesheet" href="output.css"> <link rel="stylesheet" href="output.css">
</head> </head>
<body class="w-full my-[0%] py-[0%] px-[10%] h-full bg-gray-300 dark:bg-black"> <body class="w-full my-[0%] py-[0%] px-[10%] h-full bg-gray-300 dark:bg-black">

View File

@@ -15,7 +15,7 @@ $statement = $session->prepare("SELECT id FROM users WHERE email=? ALLOW FILTERI
$result = $session->execute($statement, array('arguments' => array($email))); $result = $session->execute($statement, array('arguments' => array($email)));
if ($result->count() != 0) { if ($result->count() != 0) {
echo('The username or email address already exists. Please try another email address.'); echo('That email address is already in use. Please try another email address.');
exit(); exit();
} }