-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
114 lines (86 loc) · 2.81 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/icon?
family=Material+Icons+Outlined" rel="stylesheet">
<title>Login Form</title>
</head>
<body>
<div class="login-wrapper">
<?php
if(isset($_SESSION['userId'])) {
echo '<form action="includes/logout.inc.php" method="post">
<button type="submit" name="logout-submit">logout</button>
</form>';
}
else{
echo '<form action="includes/login.inc.php" class="form" method="post">
<img src="img/avatar.png" alt="">
<h2>Login</h2>
<div class="input-group">
<input type="text" name="mailuid" id="loginUser" required>
<label for="loginUser">User Name</label>
</div>
<div class="input-group">
<input type="password" name="pwd" id="loginPassword" required>
<label for="loginPassword">Password</label>
<span id="togglePassword"
class="material-icons-outlined">
visibility</span>
</div>
<input type="submit" name="login-submit" value="Login" class="submit-btn"><br><br>
<a href="#forgot-pw" class="forgot-pw">Forgotten Password</a> or
<a href="sign-up.php" class="forgot-pw">Sign Up</a>
</form>';
}
?>
<script>
const loginPassword = document.querySelector('#loginPassword')
const btn = document.querySelector('#togglePassword')
btn.addEventListener('click', () => {
if (loginPassword.type === "text") {
loginPassword.type = "password";
btn.innerHTML = "visibility";
} else {
loginPassword.type = "text";
btn.innerHTML = "visibility_off";
}
})
</script>
<style>
.material-icons-outlined{
position: absolute;
color: grey;
cursor: pointer;
margin: 0 -20px;
}
</style>
<div id="forgot-pw">
<form action="includes/reset-request.inc.php" method="post" class="form">
<a href="#" class="close">×</a>
<h2>Reset Password</h2>
<div class="input-group">
<input type="email" name="email" id="email" required>
<label for="email">Email</label>
</div>
<input type="submit" class="submit-btn" value="Submit" name="reset-request-submit">
</form>
<?php
if(isset($_GET["reset"])) {
if($_GET["reset"] == "success") {
echo '<p class="signupsuccess">Check your e-mail!</p>';
}
}
?>
</div>
</div>
</body>
</html>