diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 0521464..1edac81 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -644,14 +644,26 @@ routes pipe config = do , "message" .= ("Authorized!" :: String) ]) else do - status accepted202 - Web.Scotty.json - (object - [ "authorized" .= False - , "message" .= - ("ZGo shop already linked to" <> - fromMaybe "" (w_url c)) - ]) + if (E.decodeUtf8With lenientDecode . + B64.decodeLenient . C.pack . T.unpack) + siteurl == + fromMaybe "" (w_url c) + then do + status ok200 + Web.Scotty.json + (object + [ "authorized" .= True + , "message" .= ("Already authorized." :: String) + ]) + else do + status accepted202 + Web.Scotty.json + (object + [ "authorized" .= False + , "message" .= + ("ZGo shop already linked to " <> + fromMaybe "" (w_url c)) + ]) else do status accepted202 Web.Scotty.json