Throw a clear error when logging in with an invalid token

Change-Type: patch
This commit is contained in:
Tim Perry 2018-04-04 13:43:47 +02:00
parent 13a35b288f
commit dd268993b3

View File

@ -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