mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7085, CLOUDSTACK-7084: disallow empty passwords
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
8ad2e309a4
commit
e5cd75790a
|
|
@ -31,6 +31,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 com.cloud.user.Account;
|
||||
import com.cloud.user.UserAccount;
|
||||
|
|
@ -174,6 +175,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(),
|
||||
|
|
|
|||
|
|
@ -25,6 +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;
|
||||
|
|
@ -149,6 +150,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(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue