Permalink
Browse files

use AppConfig variable to force ssl

  • Loading branch information...
1 parent 0dc9554 commit b8e07f918064fd3e742a03a72cd9c6eff4f7645a @patcito patcito committed Jul 14, 2012
View
2 app/controllers/doc_controller.rb
@@ -25,7 +25,7 @@ def chat
protected
def check_ssl
- return unless RAILS_ENV == 'production'
+ return unless AppConfig.force_ssl_on_plans
if request.protocol == 'http://'
if current_group.has_custom_domain? && !current_group.is_stripe_customer?
redirect_to "https://#{AppConfig.domain}/plans?group_id=#{current_group.id}"
View
2 app/controllers/groups_controller.rb
@@ -297,7 +297,7 @@ def downgrade
end
return unless @group && current_user.owner_of?(@group)
@group.downgrade!
- if @group.has_custom_domain? || RAILS_ENV != 'production'
+ if @group.has_custom_domain? && AppConfig.force_ssl_on_plans
redirect_to "http://#{@group.domain}#{invoices_path}", :notice =>
I18n.t('groups.downgrade.notice')
View
18 app/views/invoices/index.html.haml
@@ -10,12 +10,20 @@
= raw t('invoices.index.upgrade', :current_plan => current_group.shapado_version.name)
- if current_group.is_stripe_customer?
%p.update_card
- - if current_group.has_late_payment
- %h2
- %u= link_to t('invoices.index.late_update_cc_link'), "https://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
+ - if AppConfig.force_ssl_on_plans
+ - if current_group.has_late_payment
+ %h2
+ %u= link_to t('invoices.index.late_update_cc_link'), "https://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
+ - else
+ %u
+ = link_to t('invoices.index.update_cc_link'), "https://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
- else
- %u
- = link_to t('invoices.index.update_cc_link'), "https://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
+ - if current_group.has_late_payment
+ %h2
+ %u= link_to t('invoices.index.late_update_cc_link'), "http://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
+ - else
+ %u
+ = link_to t('invoices.index.update_cc_link'), "http://#{@domain}#{manage_edit_card_path(:group_id => @group_id)}"
- if current_group.upcoming_invoice
%p
= link_to t('invoices.index.upcoming_invoice'), upcoming_invoices_path
View
3 config/shapado.yml.sample
@@ -68,12 +68,15 @@ base: &common
development:
<<: *common
+ force_ssl_on_plans: false
domain: localhost.lan
production:
<<: *common
domain: example.com
+ force_ssl_on_plans: true
googlean_domain: .shapado.com
test:
<<: *common
domain: test.loc
+ force_ssl_on_plans: false

0 comments on commit b8e07f9

Please sign in to comment.