From cd6f687531eba7e493e419c5e643288aced0f44c Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 21 May 2018 11:54:03 +0200 Subject: If connection fails, validate that we have something that looks like a valid token --- wee_slack.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wee_slack.py b/wee_slack.py index 22d9cc6..33a5ca5 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2144,6 +2144,10 @@ def handle_rtmstart(login_data, eventrouter): if not login_data["ok"]: w.prnt("", "ERROR: Failed connecting to Slack with token starting with {}: {}" .format(metadata.token[:15], login_data["error"])) + if not re.match(r"^xo\w\w(-\d+){3}-[0-9a-f]+$", metadata.token): + w.prnt("", "ERROR: Token does not look like a valid Slack token. " + "Ensure it is a valid token and not just a OAuth code.") + return # Let's reuse a team if we have it already. -- cgit