Merge branch 'stable-2.5' into stable-2.6
* stable-2.5: Release notes for 2.5.4 Require preferred email to be a verified address Corrections in the 2.5.x release notes Conflicts: ReleaseNotes/ReleaseNotes-2.5.2.txt gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java Change-Id: I08731949f0e7a87604ca003b81e6dbe63678bd82
This commit is contained in:
		@@ -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))) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user