Properly handle anonymous registrations.
| | |
| | | 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);
|
| | |
| | | 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;
|
| | |
| | | refreshUsers();
|
| | | refreshFederationRegistrations();
|
| | | isAdmin = true;
|
| | | } catch (UnauthorizedException e) {
|
| | | } catch (ForbiddenException e) {
|
| | | } catch (IOException e) {
|
| | | System.err.println(e.getMessage());
|
| | |
| | | }
|
| | |
|
| | | public boolean isOwner(RepositoryModel model) {
|
| | | return account.equalsIgnoreCase(model.owner);
|
| | | return account != null && account.equalsIgnoreCase(model.owner);
|
| | | }
|
| | |
|
| | | public IStoredSettings getSettings() {
|
| | |
| | |
|
| | | repositoriesTable.addMouseListener(new MouseAdapter() {
|
| | | public void mouseClicked(MouseEvent e) {
|
| | | if (e.getClickCount() == 2) {
|
| | | if (e.getClickCount() == 2 && gitblit.allowAdmin()) {
|
| | | editRepository(getSelectedRepositories().get(0));
|
| | | }
|
| | | }
|