Browse Source

only skip debugging screens if the endpoints are the same as before

pull/19/head
Aaron Parecki 6 years ago
parent
commit
7a3532019b
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      controllers/auth.php

+ 8
- 3
controllers/auth.php View File

@ -107,11 +107,16 @@ $app->get('/auth/start', function() use($app) {
$authorizationURL = false;
}
// If the user has already signed in before and has a micropub access token, skip
// the debugging screens and redirect immediately to the auth endpoint.
// If the user has already signed in before and has a micropub access token,
// and the endpoints are all the same, skip the debugging screens and redirect
// immediately to the auth endpoint.
// This will still generate a new access token when they finish logging in.
$user = ORM::for_table('users')->where('url', $me)->find_one();
if($user && $user->micropub_access_token && !array_key_exists('restart', $params)) {
if($user && $user->micropub_access_token
&& $user->micropub_endpoint == $micropubEndpoint
&& $user->token_endpoint == $tokenEndpoint
&& $user->authorization_endpoint == $authorizationEndpoint
&& !array_key_exists('restart', $params)) {
$user->micropub_endpoint = $micropubEndpoint;
$user->authorization_endpoint = $authorizationEndpoint;

Loading…
Cancel
Save