diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-13 18:27:19 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-13 18:27:19 +0100 |
commit | 017f39d3bdda35f97c564cfb31f9dc34ef5708af (patch) | |
tree | 799218dd55912265c642ad9cc8ccd9f04e76be67 /sonar-server/src/main/webapp/WEB-INF | |
parent | 864e78743095d214311c6acdc73c195220b020c1 (diff) | |
download | sonarqube-017f39d3bdda35f97c564cfb31f9dc34ef5708af.tar.gz sonarqube-017f39d3bdda35f97c564cfb31f9dc34ef5708af.zip |
SONAR-2084 draft of new page 'Password encryption'
Diffstat (limited to 'sonar-server/src/main/webapp/WEB-INF')
3 files changed, 63 insertions, 0 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_controller.rb new file mode 100644 index 00000000000..789b60972a6 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_controller.rb @@ -0,0 +1,47 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class EncryptionController < ApplicationController + + SECTION=Navigation::SECTION_CONFIGURATION + before_filter :admin_required + verify :method => :post, :only => [:generate_secret, :encrypt], :redirect_to => {:action => :index} + + def index + @can_encrypt=java_facade.canEncrypt() + end + + def generate_secret + begin + @secret=java_facade.generateRandomSecretKey() + rescue Exception => e + flash[:error]=e.message + redirect_to :action => :index + end + end + + def encrypt + bad_request('No secret key') unless java_facade.canEncrypt() + @encrypted=java_facade.encrypt(params[:text]) + end + + private + + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/generate_secret.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/generate_secret.html.erb new file mode 100644 index 00000000000..7323895aedc --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/generate_secret.html.erb @@ -0,0 +1,4 @@ +<p> + Secret is: + <input type="text" value="<%= @secret -%>"/> +</p>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/index.html.erb new file mode 100644 index 00000000000..06fd70d605f --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption/index.html.erb @@ -0,0 +1,12 @@ +<p>bla bla</p> + +<% if @can_encrypt %> + <form action="<%= ApplicationController.root_context -%>/encryption/encrypt" method="POST"> + <input type="text" name="text" id="text"/> + <input type="submit" value="Encrypt" id="submit_encrypt"/> + </form> +<% else %> + <form action="<%= ApplicationController.root_context -%>/encryption/generate_secret" method="POST"> + <input type="submit" value="Generate secret" id="submit_generate_secret"/> + </form> +<% end %>
\ No newline at end of file |