diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java index 94325f6d4ff..90ab7ad077a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java @@ -28,6 +28,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -162,6 +163,9 @@ public class CreateAccountCmd extends BaseCmd { @Override public void execute(){ + if (StringUtils.isEmpty(getPassword())) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed"); + } CallContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId()); UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index 378d6362a93..72365b20be4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -25,7 +25,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.context.CallContext; - +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import com.cloud.user.Account; @@ -139,6 +139,9 @@ public class CreateUserCmd extends BaseCmd { @Override public void execute(){ + if (StringUtils.isEmpty(getPassword())) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed"); + } CallContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName()); User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) {