Commit Graph

90 Commits

Author SHA1 Message Date
Paulo Castro
0bbe376e41 Remove 'signup' command
Change-type: major
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-06-04 17:06:46 +01:00
Gergely Imreh
d40f2eb500
actions/auth: fix mixed indentation error
Change-type: patch
Signed-off-by: Gergely Imreh <gergely@balena.io>
2019-05-02 13:22:22 +01:00
Matthew McGinn
3e4e661b28
Fix up small docs typo
Change-type: patch
Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
2018-12-28 08:40:18 -05:00
Tim Perry
a809847d60 Mark api keys in the CLI as non-experimental
After the recent SDK updates, they should now work everywhere

Change-type: patch
2018-11-07 16:30:56 +01:00
Tim Perry
4907fccf48 Rename everything from 'resin' to 'balena'
Change-type: major
2018-10-29 22:29:02 +01:00
Scott Lowe
7b7ae4ff89 Update sdk sdk references in auth.coffee
Change-type:patch
2018-10-18 14:51:03 +02:00
Akis Kesoglou
5cbe1c410f Add join/leave commands to promote and move devices between platforms
Both commands work with local devices by remotely invoking the `os-config` executable via SSH. This requires an as of yet unreleased resinOS (that will most likely be v2.14) and the commands ascertain compatibility merely by looking for the `os-config` executable in the device, and bail out if it’s not present.

`join` and `leave` accept a couple of optional arguments and implement a wizard-style interface if these are not given. They allow to interactively select the device and the application to promote to. If the user has no apps, `join` will offer the user to create one. `join` will also offer the user to login or create an account if they’re not logged in already without exiting the wizard.

`resin-sync` (that's used internally to discover local devices) requires admin privileges. If no device has been specified as an argument, the commands will launch the device scanning process in a privileged subprocess via two new internal commands: `internal sudo` and `internal scanDevices`. This avoids having the user to invoke the commands with sudo and only request escalation if truly needed. This commit also removes the dependency to “president”, implementing “sudo” functionality within the CLI.

Change-Type: minor
2018-07-19 22:18:02 +03:00
Tim Perry
37e4ec6364 Rename expectedError to exitWithExpectedError 2018-04-17 15:18:06 +02:00
Tim Perry
dd268993b3 Throw a clear error when logging in with an invalid token
Change-Type: patch
2018-04-04 15:43:34 +02:00
Tim Perry
12a1916007 Allow (experimental!) login with API keys
Change-Type: minor
2018-03-29 11:11:25 +02:00
Tim Perry
1c7a0ba4e1 Ensure logout works even with invalid credentials, or if not logged in
Before this point, if you had an invalid token, an expired token, or a
token for a different site, you couldn't log out to clear it properly.

Not a big deal, but awkward and messy, and easily fixed.

Change-Type: patch
2017-12-14 15:34:36 +01:00
Tim Perry
001c8f9601 Inline the entire resin-cli-auth module
This is part of a general push to demodularize any code that isn't
realistically reusable outside resin-cli, to make the codebase easier to
manage and understand. Once this is done, we'll deprecate the original
module itself.

Change-Type: patch
2017-11-27 12:02:57 +02:00
Tim Perry
1f0bec39d9 Hide the intro quickstart message for now (until it gets renovated) 2017-07-18 16:57:16 +02:00
Eugene Mirotin
77a4c6fdc2 move available-drives command to util 2017-06-15 16:43:02 +03:00
Eugene Mirotin
137473353c remove username request from the signup process 2017-03-28 14:37:11 +03:00
Eugene Mirotin
08b3db717e use individual methods promisification instead of promisifyAll 2017-03-27 12:14:55 +03:00
Tim Perry
b629ee6164
Move to preconfigured resin sdk 2017-01-25 19:33:43 +01:00
Eugene Mirotin
f17cbb1205
use the new SDK factory 2017-01-25 19:25:12 +01:00
Juan Cruz Viotti
356d2ef6b2 Inject analytics in Capitano 2016-02-12 14:34:16 -04:00
Juan Cruz Viotti
4645ad06bc Redirect users to signup from login if they don't have an account 2016-01-13 00:25:31 -04:00
Juan Cruz Viotti
c3a5998d5c Reuse messages 2016-01-12 10:45:32 -04:00
Juan Cruz Viotti
11354de596 Print an informative message after successful login 2016-01-12 10:30:56 -04:00
Juan Cruz Viotti
86cac606e4 Add Resin.io ASCII art in login 2016-01-12 10:23:46 -04:00
Juan Cruz Viotti
8d709aea7d Implement purely interactive login command
The new login command interactively asks the user if he wants to login
using web/credentials/token.
2016-01-12 09:08:03 -04:00
Juan Cruz Viotti
9cfce68489 Change license to Apache 2.0 2016-01-03 23:58:51 -04:00
Juan Cruz Viotti
b71c28cec0 Add optional credential-based authentication 2015-12-12 00:11:04 -04:00
Juan Cruz Viotti
210680c9c9 Lazy load command actions dependencies
In my system (MBPr 13), printing the current version takes over 2
seconds:

```sh
$ time ./bin/resin version
2.4.0
./bin/resin version  1.37s user 0.19s system 73% cpu 2.130 total
```

The CLI takes almost all of these time to parse the dependency tree
before returning control over the actually called command.

To mitigate this problem, we only require the NPM dependencies a command
requires when executing such command, and thus prevent dependencies from
being required and parsed unnecessary.

After this improvement, printing the original example (`resin version`)
returns in less than a second (2x improvement):

```sh
$ time ./bin/resin version
2.4.0
./bin/resin version  0.88s user 0.09s system 102% cpu 0.938 total
```
2015-12-07 11:48:54 -03:00
Juan Cruz Viotti
3997a61b78 Support for login in with token
This is useful in the scenario when the user is using the CLI in an
environment in which he/she doesn't have access to a web browser, like a
headless server or a Vagrant development environment.
2015-12-03 10:22:22 -04:00
Juan Cruz Viotti
9a89e3c3ca Perform automatic token exchange with the dashboard 2015-11-25 09:25:08 -04:00
Juan Cruz Viotti
a4642f6184 Clarify resin url on auth and whoami
When you change the `resinUrl` config from time to time it can be
confusing to remember where you're logging in, or in which host you're
in.

Currently I have to check the configuration files/environment variables
manually or run `resin settings`.

This PR prints the detected resin url on `resin login` and `resin
whoami` so it's always clear where you are.
2015-11-16 10:11:08 -04:00
Juan Cruz Viotti
c1e6a28640 Refactor validation to a single place 2015-10-21 09:37:25 -04:00
Juan Cruz Viotti
8913fb515b Implement user/password login with 2FA support 2015-10-21 08:28:20 -04:00
Juan Cruz Viotti
f8470287c1 Separate general help per topic relevance
Only list primary commands by default, unless a `--verbose` option is
passed to list the additional ones.

Fixes: https://github.com/resin-io/resin-cli/issues/101
2015-10-02 08:50:32 -04:00
Juan Cruz Viotti
79afa79fd9 Use settings from the SDK during login
This enforces all clients to use the Resin Settings Client version that
the SDK provides, reducing incompatibilities caused by different modules
requiring different Resin Settings Client versions.
2015-09-08 09:06:03 +03:00
Juan Cruz Viotti
dc257b5cab Check token validity against the API when login
Consider the following case:

The SDK is configured to point to staging, but the user passes a token
from production, or viceversa. Since the token is valid in a sense that
is valid JWT and contains real data, the CLI will report as a success.

The user will then get Unauthorized errors when using the API.
2015-09-05 20:17:34 +03:00
mike
b0650530cc Resin CLI Events integration. Fix #103 2015-09-05 19:15:31 +03:00
Juan Cruz Viotti
70c060b124 Refactor auth actions to use promises 2015-08-17 08:22:48 -04:00
Juan Cruz Viotti
e9ec6c67b2 Validate that email address is valid during signup. Fix #111
For this we use a third party dependency from npm called `valid-email`
to avoid hardcoding and having to mantain a regular expression.
2015-08-13 15:22:22 -04:00
Juan Cruz Viotti
57319f26a6 Slim down unused functionality 2015-08-12 08:17:46 -04:00
mike
f31eb7c2b5 Add email address to the returned information, when using whoami(). Fix #73. 2015-08-03 21:24:22 +03:00
mike
e2125b8ce9 Fix #73 2015-07-29 21:15:29 +03:00
mike
5b5d1be52f Integrate resin-cli-form 2015-07-27 19:50:47 +03:00
mike
64d83dccfb Add promise support for Resin-SDK dependency 2015-07-24 00:24:17 +03:00
Juan Cruz Viotti
8fa906dd48 Upgrade Resin CLI Visuals and use it's new capabilities 2015-06-11 12:46:56 -04:00
Juan Cruz Viotti
e9efb78280 Merge pull request #56 from resin-io/feature/login-feedback
Display feedback message after login
2015-06-03 08:46:18 -04:00
Juan Cruz Viotti
1ed9ae7d60 Open dashboardUrl instead of remoteUrl in auth login 2015-06-02 13:21:59 -04:00
Juan Cruz Viotti
34736c4e9b Display feedback message after login 2015-06-02 11:57:52 -04:00
Juan Cruz Viotti
f3e193be0f Make login command behave non interactively if a token is passed as an argument 2015-05-11 09:42:25 -03:00
Juan Cruz Viotti
8041905144 Remove duplicated whoami command 2015-04-20 12:46:43 -04:00
Juan Cruz Viotti
a96ab487ba Fix bug with login with token
The commit was merged from an older branch, in which settings was
still part of the SDK.
2015-04-08 08:25:27 -04:00