示例#1
0
  @SuppressWarnings("unchecked")
  @Override
  public List<Object> collectData() {
    // 读取用户名,密码
    String pwd = new String(pwdTextField.getPassword());
    String user = userField.getText();
    if (StringUtils.isEmpty(pwd) || StringUtils.isEmpty(user)) {
      DialogUtils.showErrorDialog(this.getWindow(), "smmanager.modifyselfpassword.input is null");
      return null;
    }

    List datas = new ArrayList();
    datas.add(user);
    // 加密传输
    String encryptPwd = EncryptUtils.setEncrypt(pwd, EncryptUtils.MAGIC_KEY_CLIENT);
    datas.add(encryptPwd);
    return datas;
  }
示例#2
0
 /** 初始化数据,创建默认账号 */
 private void initDefaultUserData() {
   List<User> users = getAllUsers();
   if (CollectionUtils.isEmpty(users)) {
     User admin = new User();
     admin.setUserName("admin");
     admin.setPassword(EncryptUtils.setEncrypt("admin", EncryptUtils.MAGIC_KEY_CLIENT));
     // 设置缺省的role
     List<String> roles = new ArrayList<String>();
     roles.add("admin");
     admin.setRoles(roles);
     // 设置缺省的管理范围
     MoCore moCore =
         SmCoreContext.getLocalService(MoCoreModuleConstants.MOCORE_LOCAL_SERVICE, MoCore.class);
     MoNaming rootMo = moCore.getRootMo().getMoNaming();
     List<MoNaming> mgmtScope = new ArrayList<MoNaming>();
     mgmtScope.add(rootMo);
     admin.setMgmtScope(mgmtScope);
     addUser(admin);
   }
 }