From dd268993b34b03a2348bd75fc4b78fefbb758def Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 4 Apr 2018 13:43:47 +0200 Subject: [PATCH] Throw a clear error when logging in with an invalid token Change-Type: patch --- lib/actions/auth.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/actions/auth.coffee b/lib/actions/auth.coffee index 69529b35..2df18d20 100644 --- a/lib/actions/auth.coffee +++ b/lib/actions/auth.coffee @@ -88,6 +88,11 @@ exports.login = name: 'token' type: 'input' .then(resin.auth.loginWithToken) + .tap -> + resin.auth.whoami() + .then (username) -> + if !username + patterns.expectedError('Token authentication failed') else if options.credentials return patterns.authenticate(options) else if options.web