aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2018-05-21 11:54:03 +0200
committerTollef Fog Heen <tfheen@err.no>2018-05-21 11:54:03 +0200
commitcd6f687531eba7e493e419c5e643288aced0f44c (patch)
treed8fb8a7148f2611296714d7bba98e933da3354eb /wee_slack.py
parentfaf02adfda81d694746efeedbbe2e5c64b37c79a (diff)
downloadwee-slack-cd6f687531eba7e493e419c5e643288aced0f44c.tar.gz
If connection fails, validate that we have something that looks like a valid token
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py4
1 files changed, 4 insertions, 0 deletions
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.