diff --git a/lib/login.js b/lib/login.js index 2de8df3..875f7ae 100644 --- a/lib/login.js +++ b/lib/login.js @@ -7,6 +7,7 @@ import chalk from 'chalk' import fetch from 'node-fetch' import {validate} from 'email-validator' import readEmail from 'email-prompt' +import ora from 'ora' // Ours import pkg from '../../package' @@ -62,13 +63,18 @@ async function register(url, {retryEmail = false} = {}) { } const {token, securityCode} = await getVerificationData(url, email) - console.log(`> Please follow the link sent to ${chalk.bold(email)} to log in.`) + if (securityCode) { console.log(`> Verify that the provided security code in the email matches ${chalk.cyan(chalk.bold(securityCode))}.`) } - process.stdout.write('> Waiting for confirmation..') + process.stdout.write('\n') + + const spinner = ora({ + text: 'Waiting for confirmation...', + color: 'black' + }).start() let final @@ -78,10 +84,11 @@ async function register(url, {retryEmail = false} = {}) { try { final = await verify(url, email, token) } catch (err) {} - - process.stdout.write('.') } while (!final) + spinner.text = 'Confirmed email address!' + spinner.stopAndPersist('✔') + process.stdout.write('\n') return {email, token: final} diff --git a/package.json b/package.json index a12bc52..ce81f1b 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "ms": "0.7.2", "node-fetch": "1.6.3", "node-version": "1.0.0", + "ora": "0.3.0", "progress": "1.1.8", "psl": "1.1.15", "resumer": "0.0.0",