Browse Source

send user-agent on login (#75)

master
Naoyuki Kanezawa 9 years ago
committed by Guillermo Rauch
parent
commit
7cab91211e
  1. 8
      lib/login.js

8
lib/login.js

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

Loading…
Cancel
Save