James Moger
2011-10-20 5ae0b71e1e6e73e4bacf321a7d5be49fcdf4ad97
Properly handle anonymous registrations.
3 files modified
15 ■■■■ changed files
src/com/gitblit/client/GitblitManager.java 9 ●●●● patch | view | raw | blame | history
src/com/gitblit/client/GitblitModel.java 4 ●●● patch | view | raw | blame | history
src/com/gitblit/client/GitblitPanel.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/client/GitblitManager.java
@@ -316,9 +316,14 @@
                Date lastLogin = dateFormat.parse(config.getString("servers", server, "lastLogin"));
                String url = config.getString("servers", server, "url");
                String account = config.getString("servers", server, "account");
                char[] password;
                String pw = config.getString("servers", server, "password");
                if (StringUtils.isEmpty(pw)) {
                    password = new char[0];
                } else {
                // FIXME this is pretty lame
                char[] password = new String(Base64.decode(config.getString("servers", server,
                        "password"))).toCharArray();
                    password = new String(Base64.decode(pw)).toCharArray();
                }
                GitblitRegistration reg = new GitblitRegistration(server, url, account, password);
                reg.lastLogin = lastLogin;
                registrations.put(reg.name, reg);
src/com/gitblit/client/GitblitModel.java
@@ -23,6 +23,7 @@
import java.util.Map;
import com.gitblit.GitBlitException.ForbiddenException;
import com.gitblit.GitBlitException.UnauthorizedException;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.models.FederationModel;
@@ -68,6 +69,7 @@
            refreshUsers();
            refreshFederationRegistrations();
            isAdmin = true;
        } catch (UnauthorizedException e) {
        } catch (ForbiddenException e) {
        } catch (IOException e) {
            System.err.println(e.getMessage());
@@ -79,7 +81,7 @@
    }
    public boolean isOwner(RepositoryModel model) {
        return account.equalsIgnoreCase(model.owner);
        return account != null && account.equalsIgnoreCase(model.owner);
    }
    public IStoredSettings getSettings() {
src/com/gitblit/client/GitblitPanel.java
@@ -217,7 +217,7 @@
        
        repositoriesTable.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                if (e.getClickCount() == 2 && gitblit.allowAdmin()) {
                    editRepository(getSelectedRepositories().get(0));
                }
            }