|
|
@ -5,6 +5,7 @@ import * as cfg from './cfg'; |
|
|
|
import { stringify as stringifyQuery } from 'querystring'; |
|
|
|
import { validate } from 'email-validator'; |
|
|
|
import readEmail from 'email-prompt'; |
|
|
|
import ua from './ua'; |
|
|
|
import pkg from '../../package.json'; |
|
|
|
|
|
|
|
async function getVerificationToken (url, email) { |
|
|
@ -14,7 +15,8 @@ async function getVerificationToken (url, email) { |
|
|
|
method: 'POST', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Content-Length': Buffer.byteLength(data) |
|
|
|
'Content-Length': Buffer.byteLength(data), |
|
|
|
'User-Agent': ua |
|
|
|
}, |
|
|
|
body: data |
|
|
|
}); |
|
|
@ -33,7 +35,9 @@ async function verify (url, email, verificationToken) { |
|
|
|
token: verificationToken |
|
|
|
}; |
|
|
|
|
|
|
|
const res = await fetch(`${url}/now/registration/verify?${stringifyQuery(query)}`); |
|
|
|
const res = await fetch(`${url}/now/registration/verify?${stringifyQuery(query)}`, { |
|
|
|
headers: { 'User-Agent': ua } |
|
|
|
}); |
|
|
|
const body = await res.json(); |
|
|
|
return body.token; |
|
|
|
} |
|
|
|