Die when no email is found

This commit is contained in:
Jelle Besseling 2021-01-04 18:09:05 +01:00
parent 20d8134936
commit c49ca66689
No known key found for this signature in database
GPG key ID: 9712452E8BE3372E

View file

@ -191,6 +191,8 @@ sub github_login :Path('/github-login') Args(0) {
$email = $eml->{email} if $eml->{verified} && $eml->{primary};
}
die "No primary email for this GitHub profile" unless $email;
$response = $ua->get('https://api.github.com/user', Authorization => "token $access_token");
error($c, "Did not get a response from GitHub for user info.") unless $response->is_success;
$data = decode_json($response->decoded_content) or die;