mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-03-25 09:25:49 +00:00
More aggressively persis the user's email address in the account object.
This commit is contained in:
parent
735ac7ffb3
commit
a270579f36
1 changed files with 7 additions and 0 deletions
|
|
@ -369,6 +369,13 @@ func githubOAuthCallbackHandler(w http.ResponseWriter, r *http.Request) *AppErro
|
|||
account = &Account{GitHubUserId: *user.ID}
|
||||
}
|
||||
account.OAuthToken = *token
|
||||
// Persist the default email address now, both to avoid additional lookups
|
||||
// later and to have a way to contact the user if they ever revoke their
|
||||
// OAuth token.
|
||||
emailAddress, err := account.GetDigestEmailAddress(githubClient)
|
||||
if err == nil && len(emailAddress) > 0 {
|
||||
account.DigestEmailAddress = emailAddress
|
||||
}
|
||||
err = account.Put(c)
|
||||
if err != nil {
|
||||
return InternalError(err, "Could not save user")
|
||||
|
|
|
|||
Loading…
Reference in a new issue