Switched to Google Oauth2 for login.
Copy init.php.in to init.php Set database username, password Set $GoogleClientID and $GoogleClientSecret To get those: * Navigate to the Google Cloud Console. https://cloud.google.com/console * Click on the Create Project button on top of the page, enter the following values and then click on the Create button. * Once the project has been created, open the APIs & auth group (left navigation pannel) and then click on Consent screen and set it up (this is just for what is shown to the user, values not important) * Open the APIs & auth group in the left pannel (if it's not already open) and click on Credentials. * Click on the CREATE NEW CLIENT ID button, enter/tick the following values and then click on the Create Client ID button. Application type: Web Application Authorized Javascript origins: http://crash.replex.org Authorized redirect URI: http://crash.replex.org/process_login.php (replace with appropriate links. imporant bit is url to process_login.php) You will now have Client ID and Client secret
This commit is contained in:
@@ -3,15 +3,14 @@
|
||||
define("SITE_ROOT", realpath(dirname(__file__)));
|
||||
require_once SITE_ROOT . "/lib/init.php";
|
||||
|
||||
$google_response = GoogleOpenID::getResponse();
|
||||
$success = $google_response->success();//true or false
|
||||
if (!$success)
|
||||
|
||||
if (!isset($_GET["code"]) || !GoogleLogin::verifyLogin($_GET["code"]))
|
||||
{
|
||||
http::redirect("/login_failed.php");
|
||||
}
|
||||
|
||||
$user_identity = $google_response->identity();//the user's ID
|
||||
$user_email = $google_response->email();//the user's email
|
||||
$user_identity = GoogleLogin::userID();
|
||||
$user_email = GoogleLogin::userEmail();
|
||||
|
||||
$user = User::getByLogin($user_identity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user