diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-20 17:05:46 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-20 17:05:46 +0100 |
commit | 5a02b34cdb4e12d6714e57826201402848143e1f (patch) | |
tree | 43d65a7238e2fdee2f767c3ed5d58ac4e7506de8 | |
parent | 1f1fdac53b61b8893c00c51862ce3719f3e717f4 (diff) | |
download | sonarqube-5a02b34cdb4e12d6714e57826201402848143e1f.tar.gz sonarqube-5a02b34cdb4e12d6714e57826201402848143e1f.zip |
SONAR-2084 improve usability
5 files changed, 31 insertions, 25 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb index d24569af8c4..fc1ca0afbdc 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb @@ -38,12 +38,14 @@ class EncryptionConfigurationController < ApplicationController end def generate_secret - render :text => java_facade.generateRandomSecretKey() + @secret = java_facade.generateRandomSecretKey() + render :partial => 'encryption_configuration/generate_secret_key' end def encrypt bad_request('No secret key') unless java_facade.hasSecretKey() - render :text => java_facade.encrypt(params[:text]) + @encrypted = java_facade.encrypt(params[:text]) + render :partial => 'encryption_configuration/encrypt' end private diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb new file mode 100644 index 00000000000..668e96cecc3 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb @@ -0,0 +1 @@ +<p class="spacer-bottom">Encrypted value: <input type="text" id="encrypted_text" size="40" readonly="readonly" class="notice" value="<%= @encrypted -%>"></p>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb new file mode 100644 index 00000000000..af3a720ff3e --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb @@ -0,0 +1,11 @@ +<ul class="bullet"> + <li>Store the secret key <input type="text" size="40" readonly="readonly" id="secret" value="<%= @secret -%>" class="notice"/> in the file <code>~/.sonar/sonar-secret.txt</code> of the server. This file can be relocated + by defining the property <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code></li> + <li>Restrict access to this file by making it readable and by owner only</li> + <li>Restart the server if the property <code>sonar.secretKeyPath</code> has been set or changed.</li> + <li>Copy this file on all the machines that execute code inspection. Define the property <code>sonar.secretKeyPath</code> on those machines if the path is not <code>~/.sonar/sonar-secret.txt</code>.</li> + <li>For each property that you want to encrypt, <%= link_to 'generate the encrypted value', {:action => 'index'}, {:class => 'link-action'} -%> + and replace the original values where ever they are stored + (configuration files, command lines) + </li> +</ul>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb index 8ef137857ef..79a5f39ac66 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb @@ -1,22 +1,11 @@ -<p>Secret key is required to be able to encrypt properties. Please follow those steps :</p> -<ul class="bullet"> - <li> - <%= button_to_remote 'Generate a random key', +<h3 class="spacer-bottom">Encryption</h3> +<p class="spacer-bottom">Secret key is required to be able to encrypt properties. <a href="http://docs.codehaus.org/display/SONAR/Settings+Encryption" class="external">More information</a>.</p> +<div id="secret_content"> + <%= button_to_remote 'Generate secret key', :url => {:action => 'generate_secret'}, - :update => {:success => 'secret', :failure => 'secret_error'}, - :success => "$('secret').show()", + :update => {:success => 'secret_content', :failure => 'secret_error'}, :failure => "$('secret_error').show()", :method => 'POST', :id => 'submit_generate_secret' -%> - <span id="secret" class="notice" style="display:none"></span> - <span id="secret_error" class="error" style="display:none"></span> - </li> - <li>Store this key in the file <code>~/.sonar/sonar-secret.txt</code> of the server. This file can be relocated - by defining the property <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code></li> - <li>Restrict access to this file by making it readable and by owner only</li> - <li>Copy this file on all the machines that execute code inspection. Define the property <code>sonar.secretKeyPath</code> on those machines if needed.</li> - <li>For each property that you want to encrypt, <%= link_to 'generate the encrypted value', {:action => 'index'}, {:class => 'link-action'} -%> - and replace the original values where ever they are stored - (configuration files, command lines) - </li> -</ul>
\ No newline at end of file + <span id="secret_error" class="error" style="display:none"></span> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb index b5d6c4fad04..53added8995 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb @@ -1,17 +1,20 @@ +<h3 class="spacer-bottom">Encryption</h3> <p class="spacer-bottom">Secret key is registered. You can encrypt any property value with the following form :</p> <%= form_remote_tag :url => {:action => 'encrypt'}, - :update => {:success => 'encrypted_text', :failure => 'encryption_error'}, - :success => "$('encrypted_text').show()", + :update => {:success => 'encrypted_section', :failure => 'encryption_error'}, + :success => "$('encrypted_section').show();$('encryption_error').hide();", :failure => "$('encryption_error').show()", :html => {:class => 'spacer-bottom'} -%> <input type="text" name="text" id="clear_text"/> <input type="submit" value="Encrypt" id="submit_encrypt"/> -<span id="encrypted_text" class="notice" style="display:none"></span> -<span id="encryption_error" class="error" style="display:none"></span> </form> + +<div id="encrypted_section" style="display:none"></div> +<span id="encryption_error" class="error" style="display:none"></span> + <p>Note that the <%= link_to 'secret key can be changed', {:action => 'generate_secret_form'}, :class => 'link-action' -%> - but all the encrypted properties will have to be updated.</p> + but all the encrypted properties will have to be updated. <a href="http://docs.codehaus.org/display/SONAR/Settings+Encryption" class="external">More information</a>.</p> <script> $('clear_text').focus(); </script>
\ No newline at end of file |