James Moger
2012-11-27 44f6238fd5fe7675e7de43f4a42d1f7dabcfee4e
Tweak to GCA config, fix send mail prompts, added authority.cmd
1 files added
3 files modified
21 ■■■■■ changed files
distrib/authority.cmd 1 ●●●● patch | view | raw | blame | history
distrib/authority.conf 3 ●●●● patch | view | raw | blame | history
src/com/gitblit/authority/GitblitAuthority.java 16 ●●●●● patch | view | raw | blame | history
src/com/gitblit/authority/NewClientCertificateDialog.java 1 ●●●● patch | view | raw | blame | history
distrib/authority.cmd
New file
@@ -0,0 +1 @@
@java -jar authority.jar
distrib/authority.conf
@@ -3,4 +3,5 @@
    organizationalUnit = Gitblit
    organization = Gitblit
    locality = Gitblit
    stateProvince = NY
    stateProvince = NY
    countryCode = US
src/com/gitblit/authority/GitblitAuthority.java
@@ -129,6 +129,8 @@
    private JButton certificateDefaultsButton;
    private JButton newSSLCertificate;
    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
@@ -296,13 +298,15 @@
            if (!caKeystore.exists()) {
                // show certificate defaults dialog 
                certificateDefaultsButton.doClick();
                // create "localhost" ssl certificate
                prepareX509Infrastructure();
            }
        }
    }
    
    private boolean prepareX509Infrastructure() {
        if (caKeystorePassword == null) {
            caKeystorePassword = gitblitSettings.getString(Keys.server.storePassword, null);
            JPasswordField pass = new JPasswordField(10){
                private static final long serialVersionUID = 1L;
@@ -320,7 +324,6 @@
            if (result == JOptionPane.OK_OPTION) {
                caKeystorePassword = new String(pass.getPassword());
            } else {
                caKeystorePassword = null;
                return false;
            }
        }
@@ -594,7 +597,7 @@
            }
        });
        
        JButton newSSLCertificate = new JButton(new ImageIcon(getClass().getResource("/rosette_16x16.png")));
        newSSLCertificate = new JButton(new ImageIcon(getClass().getResource("/rosette_16x16.png")));
        newSSLCertificate.setFocusable(false);
        newSSLCertificate.setToolTipText(Translation.get("gb.newSSLCertificate"));        
        newSSLCertificate.addActionListener(new ActionListener() {
@@ -672,8 +675,7 @@
                            metadata.serverHostname = Constants.NAME;
                        }
                        metadata.userDisplayname = ucm.user.getDisplayName();
                        sendEmail(ucm.user, metadata, zip);
                        return true;
                        return sendEmail(ucm.user, metadata, zip);
                    }
                    @Override
@@ -780,7 +782,7 @@
        }
    }
    
    private void sendEmail(UserModel user, X509Metadata metadata, File zip) {
    private boolean sendEmail(UserModel user, X509Metadata metadata, File zip) {
        // send email
        try {
            if (mail.isReady()) {
@@ -807,11 +809,13 @@
                message.setContent(mp);
                mail.sendNow(message);
                return true;
            } else {
                JOptionPane.showMessageDialog(GitblitAuthority.this, "Sorry, the mail server settings are not configured properly.\nCan not send email.", Translation.get("gb.error"), JOptionPane.ERROR_MESSAGE);
            }
        } catch (Exception e) {
            Utils.showException(GitblitAuthority.this, e);
        }
        return false;
    }
}
src/com/gitblit/authority/NewClientCertificateDialog.java
@@ -119,6 +119,7 @@
        message.setLineWrap(true);
        message.setWrapStyleWord(true);
        message.setEditable(false);
        message.setRows(6);
        message.setPreferredSize(new Dimension(300, 100));
        
        content.add(new JScrollPane(message), BorderLayout.CENTER);