From 7a3532019bb992e46d1d4bd7bd1b157834a7cf69 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 12 Jul 2015 13:57:59 -0700 Subject: [PATCH] only skip debugging screens if the endpoints are the same as before --- controllers/auth.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/auth.php b/controllers/auth.php index 26aa933..1244fe0 100644 --- a/controllers/auth.php +++ b/controllers/auth.php @@ -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;