Rev 715 | Rev 866 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 715 | Rev 801 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0'); |
51 | curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0'); |
52 | curl_setopt($ch, CURLOPT_POST, 1); |
52 | curl_setopt($ch, CURLOPT_POST, 1); |
53 | curl_setopt($ch, CURLOPT_POSTFIELDS, |
53 | curl_setopt($ch, CURLOPT_POSTFIELDS, |
54 | "grant_type=authorization_code&". |
54 | "grant_type=authorization_code&". |
55 | "code=".urlencode($_GET['code'])."&". |
55 | "code=".urlencode($_GET['code'])."&". |
56 | "redirect_uri=".urlencode(OIDplus::webpath(__DIR__,false).'oauth.php')."&". |
56 | "redirect_uri=".urlencode(OIDplus::webpath(__DIR__,OIDplus::PATH_ABSOLUTE_CANONICAL).'oauth.php')."&". |
57 | "client_id=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_ID'))."&". |
57 | "client_id=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_ID'))."&". |
58 | "client_secret=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_SECRET')) |
58 | "client_secret=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_SECRET')) |
59 | ); |
59 | ); |
60 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
60 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
61 | $cont = curl_exec($ch); |
61 | $cont = curl_exec($ch); |
Line 120... | Line 120... | ||
120 | 120 | ||
121 | OIDplus::db()->query("UPDATE ###ra set last_login = ".OIDplus::db()->sqlDate()." where email = ?", array($email)); |
121 | OIDplus::db()->query("UPDATE ###ra set last_login = ".OIDplus::db()->sqlDate()." where email = ?", array($email)); |
122 | 122 | ||
123 | // Go back to OIDplus |
123 | // Go back to OIDplus |
124 | 124 | ||
125 | header('Location:'.OIDplus::webpath(null,false)); |
125 | header('Location:'.OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL)); |
126 | } |
126 | } |
127 | 127 | ||
128 | } finally { |
128 | } finally { |
129 | 129 | ||
130 | // We now have the data of the person that wanted to log in |
130 | // We now have the data of the person that wanted to log in |