Browse files

Do not overwrite user's email, unless it's empty

  • Loading branch information...
1 parent c5925f5 commit 88f6ee7c893bf509527df6c965e495c0d145c60c @orenhe committed Mar 4, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
View
5 src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
@@ -318,7 +318,10 @@ public HttpResponse doFinishLogin(StaplerRequest request)
GHUser self = auth.getGitHub().getMyself();
User u = User.current();
u.setFullName(self.getName());
- u.addProperty(new Mailer.UserProperty(self.getEmail()));
+ // Set email from github only if empty
+ if (u.getProperty(Mailer.UserProperty.class).getAddress() == null) {
+ u.addProperty(new Mailer.UserProperty(self.getEmail()));
+ }
}
else {
Log.info("github did not return an access token.");

0 comments on commit 88f6ee7

Please sign in to comment.