-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
33 lines (31 loc) · 1.23 KB
/
login.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
<?php
require_once('../mysqlaccess.php');
if ($_POST['remember'] == 1) {
// keep logged in for one month
$rememberDuration = (int) (60 * 60 * 24 * 30);
}
else {
// do not keep logged in after session ends
$rememberDuration = null;
}
try {
$auth->login($_POST['email'], $_POST['password'], $rememberDuration);
// user is logged in
echo "OK";
}
catch (\Delight\Auth\InvalidEmailException $e) {
// wrong email address
echo "Wrong Email, please try again";
}
catch (\Delight\Auth\InvalidPasswordException $e) {
// wrong password
echo "Wrong Password, please try again";
}
catch (\Delight\Auth\EmailNotVerifiedException $e) {
// email not verified
echo "Email not verified, please check your email and follow the link there. If you don't see an email from no-reply@pox.jch.ooo, check your spam folder. If you still don't see an email, you can try requesting another <a href='/email_confirmation'>here</a>.";
}
catch (\Delight\Auth\TooManyRequestsException $e) {
// too many requests
echo "You made too many requests in a short period of time. Please wait a while and try again.";
}