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:
Latif Khalifa
2014-06-05 17:32:11 +02:00
parent 0bf3cf72d7
commit 5731b4ae24
6 changed files with 121 additions and 508 deletions

View File

@@ -32,27 +32,6 @@
class Layout
{
static function getLoginGateway()
{
$assoc_handle_expires = (int)Option::get('assoc_handle_expires');
$now = time();
$assoc_handle = Option::get("assoc_handle");
if (!$assoc_handle || $assoc_handle_expires < $now)
{
$assoc_handle_expires = time() + 604800;
$assoc_handle = GoogleOpenID::getAssociationHandle();
if ($assoc_handle)
{
Option::update("assoc_handle_expires", $assoc_handle_expires);
Option::update("assoc_handle", $assoc_handle);
}
}
return GoogleOpenID::createRequest(URL_ROOT . "/process_login.php", $handle, true);
}
static function since($since)
{
$since = time() - $since;
@@ -88,7 +67,7 @@ class Layout
{
$item = new stdClass;
$item->label = "Login";
$item->link = self::getLoginGateway()->getRequestURL();
$item->link = GoogleLogin::loginURL();
$menu[] = $item;
}
else