Hybris95
2014-04-22 3f5b8f5d9203aa7ffb7fbe9cdbaf9dba3da6cae6
src/main/java/com/gitblit/wicket/pages/EditUserPage.java
@@ -54,10 +54,6 @@
   public EditUserPage() {
      // create constructor
      super();
      if (!app().users().supportsAddUser()) {
         error(MessageFormat.format(getString("gb.userServiceDoesNotPermitAddUser"),
               app().settings().getString(Keys.realm.userService, "${baseFolder}/users.conf")), true);
      }
      isCreate = true;
      setupPage(new UserModel(""));
      setStatelessHint(false);
@@ -110,7 +106,7 @@
      final Palette<String> teams = new Palette<String>("teams", new ListModel<String>(
            new ArrayList<String>(userTeams)), new CollectionModel<String>(app().users()
            .getAllTeamnames()), new StringChoiceRenderer(), 10, false);
            .getAllTeamNames()), new StringChoiceRenderer(), 10, false);
      Form<UserModel> form = new Form<UserModel>("editForm", model) {
         private static final long serialVersionUID = 1L;
@@ -138,7 +134,7 @@
            }
            boolean rename = !StringUtils.isEmpty(oldName)
                  && !oldName.equalsIgnoreCase(username);
            if (app().users().supportsCredentialChanges(userModel)) {
            if (app().authentication().supportsCredentialChanges(userModel)) {
               if (!userModel.password.equals(confirmPassword.getObject())) {
                  error(getString("gb.passwordsDoNotMatch"));
                  return;
@@ -157,6 +153,9 @@
                           minLength));
                     return;
                  }
                  // change the cookie
                  userModel.cookie = StringUtils.getSHA1(userModel.username + password);
                  // Optionally store the password MD5 digest.
                  String type = app().settings().getString(Keys.realm.passwordStorage, "md5");
@@ -192,7 +191,11 @@
            }
            try {
               app().users().updateUserModel(oldName, userModel, isCreate);
               if (isCreate) {
                  app().gitblit().addUser(userModel);
               } else {
                  app().gitblit().reviseUser(oldName, userModel);
               }
            } catch (GitBlitException e) {
               error(e.getMessage());
               return;
@@ -214,16 +217,16 @@
      form.add(new SimpleAttributeModifier("autocomplete", "off"));
      // not all user services support manipulating username and password
      boolean editCredentials = app().users().supportsCredentialChanges(userModel);
      boolean editCredentials = app().authentication().supportsCredentialChanges(userModel);
      // not all user services support manipulating display name
      boolean editDisplayName = app().users().supportsDisplayNameChanges(userModel);
      boolean editDisplayName = app().authentication().supportsDisplayNameChanges(userModel);
      // not all user services support manipulating email address
      boolean editEmailAddress = app().users().supportsEmailAddressChanges(userModel);
      boolean editEmailAddress = app().authentication().supportsEmailAddressChanges(userModel);
      // not all user services support manipulating team memberships
      boolean editTeams = app().users().supportsTeamMembershipChanges(userModel);
      boolean editTeams = app().authentication().supportsTeamMembershipChanges(userModel);
      // field names reflective match UserModel fields
      form.add(new TextField<String>("username").setEnabled(editCredentials));
@@ -240,6 +243,8 @@
      form.add(new CheckBox("canFork").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));
      form.add(new CheckBox("canCreate"));
      form.add(new CheckBox("excludeFromFederation"));
      form.add(new CheckBox("disabled"));
      form.add(new RegistrantPermissionsPanel("repositories",   RegistrantType.REPOSITORY, repos, permissions, getAccessPermissions()));
      form.add(teams.setEnabled(editTeams));