if ($isEmail) { $key = json_decode($db->get($key)); if ($key) { $name = $key; $key = RenegadeConstants::kTypeUser . ':' . $key; $data = $db->get($key); } } else { $data = $db->get($key); } if ($data) { $user = json_decode($data, true); if ($user['verified'] == true) { if ($password == $user['password']) { // SUCCESS Renegade::authorizeUser($name); header('Location: /'); } else { // INVALID PASSWORD echo 'invalid password'; } } else { // NOT VERIFIED // the user is valid, and they provided the proper credentials, // but they are not verified by their e-mail address echo 'user not verified'; } } else { // NO USER echo 'no such user'; }