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