fix: rename “users.token” => "users.github_token”

pull/2572/head
Luke Edwards 7 years ago
parent 35485f995b
commit e3331aca58

@ -6,7 +6,7 @@ exports.up = DB => {
name character varying(255), name character varying(255),
username character varying(255) not null, username character varying(255) not null,
avatar text, avatar text,
token character varying(255) not null, github_token character varying(255) not null,
created_at timestamp with time zone NOT NULL DEFAULT now(), created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone updated_at timestamp with time zone
); );

@ -79,7 +79,8 @@ export function API() {
send(res, 302, Location, { Location }); send(res, 302, Location, { Location });
} catch (err) { } catch (err) {
// console.error('GET /auth/login', err);
send(res, 500);
} }
}); });
@ -105,9 +106,9 @@ export function API() {
// Upsert `users` table // Upsert `users` table
const [user] = await query(` const [user] = await query(`
insert into users(uid, name, username, avatar, token) insert into users(uid, name, username, avatar, github_token)
values ($1, $2, $3, $4, $5) on conflict (uid) do update values ($1, $2, $3, $4, $5) on conflict (uid) do update
set (name, username, avatar, token, updated_at) = ($2, $3, $4, $5, now()) set (name, username, avatar, github_token, updated_at) = ($2, $3, $4, $5, now())
returning * returning *
`, [id, name, login, avatar_url, access_token]); `, [id, name, login, avatar_url, access_token]);
@ -121,7 +122,7 @@ export function API() {
'Content-Type': 'text/html; charset=utf-8' 'Content-Type': 'text/html; charset=utf-8'
}); });
} catch (err) { } catch (err) {
console.error('OAuth Callback', err); console.error('GET /auth/callback', err);
send(res, 500, err.data, { send(res, 500, err.data, {
'Content-Type': err.headers['content-type'], 'Content-Type': err.headers['content-type'],
'Content-Length': err.headers['content-length'] 'Content-Length': err.headers['content-length']

Loading…
Cancel
Save