|
|
@ -3,6 +3,7 @@ import { join as pathJoin } from 'path'; |
|
|
|
import fs from 'fs-promise'; |
|
|
|
import fetch from 'node-fetch'; |
|
|
|
import { stringify as stringifyQuery } from 'querystring'; |
|
|
|
import chalk from 'chalk'; |
|
|
|
|
|
|
|
const stdin = process.openStdin(); |
|
|
|
|
|
|
@ -58,17 +59,20 @@ async function register () { |
|
|
|
const email = await readEmail(); |
|
|
|
const verificationToken = await getVerificationToken(email); |
|
|
|
|
|
|
|
console.log('> Please follow the link in your email to log in.'); |
|
|
|
console.log('> Waiting for confirmation…'); |
|
|
|
console.log(`> Please follow the link sent to ${chalk.bold(email)} to log in.`); |
|
|
|
process.stdout.write('> Waiting for confirmation..'); |
|
|
|
|
|
|
|
let final; |
|
|
|
do { |
|
|
|
await sleep(5000); |
|
|
|
await sleep(2500); |
|
|
|
try { |
|
|
|
final = await verify(email, verificationToken); |
|
|
|
} catch (e) {} |
|
|
|
process.stdout.write('.'); |
|
|
|
} while (!final); |
|
|
|
|
|
|
|
process.stdout.write('\n'); |
|
|
|
|
|
|
|
return { email, token: final }; |
|
|
|
} |
|
|
|
|
|
|
|