Use email api call

[?]
Dec 30, 2020, 8:32 PM
3CH2DFTVNEMFSXYZULOUAJFH2M2RXDPHJJL34TI3TVR34IMTEU7AC

Dependencies

  • [2] GNQYRBAG Implement GitHub logins
  • [3] 3QWDDLBR Add support for logging in via a Google account
  • [*] XJRJ4J7M Add user registration

Change contents

  • edit in src/lib/Hydra/Controller/User.pm at line 183
    [2.1353]
    [2.1353]
    $response = $ua->get('https://api.github.com/user/emails', Accept => 'application/vnd.github.v3+json', Authorization => "token $access_token");
    error($c, "Did not get a response from GitHub for email info.") unless $response->is_success;
    $data = decode_json($response->decoded_content) or die;
    my $email;
    foreach my $eml (@{$data}) {
    $email = $eml->{email} if $eml->{verified} && $eml->{primary};
    print STDERR "$eml->{email}\n";
    }
  • edit in src/lib/Hydra/Controller/User.pm at line 195
    [2.1354]
    [2.1354]
    print STDERR "$email\n";
  • edit in src/lib/Hydra/Controller/User.pm at line 198
    [2.1548][2.1548:1549]()
  • replacement in src/lib/Hydra/Controller/User.pm at line 199
    [2.1609][2.1609:1688]()
    doEmailLogin($self, $c, "github", $data->{email}, $data->{name} // undef);
    [2.1609]
    [2.1688]
    doEmailLogin($self, $c, "github", $email, $data->{name} // undef);