diff options
author | Shawn Pearce <sop@google.com> | 2013-05-18 13:08:35 -0700 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2013-05-18 13:08:35 -0700 |
commit | 94b42aaf584531c3f5d3960556638241194bb9b8 (patch) | |
tree | 897a46d968486dcc073ec69dd24b2d0fc39e7c74 /gerrit-httpd | |
parent | 224d87e99c9a7ec0895d1eeebabc976bf7983a11 (diff) | |
parent | cd4f464a087a8710365a8aae8f147bc8d1339324 (diff) |
Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
Release notes for 2.5.4
Require preferred email to be a verified address
Corrections in the 2.5.x release notes
Diffstat (limited to 'gerrit-httpd')
-rw-r--r-- | gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java index 11846d3e44..6d183b8201 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java @@ -14,6 +14,7 @@ package com.google.gerrit.httpd.rpc.account; +import com.google.common.base.Strings; import com.google.gerrit.common.ChangeHooks; import com.google.gerrit.common.data.AccountSecurity; import com.google.gerrit.common.data.ContributorAgreement; @@ -217,12 +218,17 @@ class AccountSecurityImpl extends BaseServiceImplementation implements final ContactInformation info, final AsyncCallback<Account> callback) { run(callback, new Action<Account>() { public Account run(ReviewDb db) throws OrmException, Failure { - final Account me = db.accounts().get(user.get().getAccountId()); + IdentifiedUser self = user.get(); + final Account me = db.accounts().get(self.getAccountId()); final String oldEmail = me.getPreferredEmail(); if (realm.allowsEdit(Account.FieldName.FULL_NAME)) { - me.setFullName(name != null && !name.isEmpty() ? name : null); + me.setFullName(Strings.emptyToNull(name)); } - me.setPreferredEmail(emailAddr); + if (!Strings.isNullOrEmpty(emailAddr) + && !self.getEmailAddresses().contains(emailAddr)) { + throw new Failure(new PermissionDeniedException("Email address must be verified")); + } + me.setPreferredEmail(Strings.emptyToNull(emailAddr)); if (useContactInfo) { if (ContactInformation.hasAddress(info) || (me.isContactFiled() && ContactInformation.hasData(info))) { |