Skip to content

Commit

Permalink
Fixed using force_ssl.
Browse files Browse the repository at this point in the history
  • Loading branch information
yalab committed Nov 18, 2011
1 parent b3d09e6 commit 59e05d2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 27 deletions.
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
@@ -1,4 +1,5 @@
class ApplicationController < ActionController::Base
force_ssl
protect_from_forgery
before_filter{
@javascripts = []
Expand Down
6 changes: 3 additions & 3 deletions app/views/layouts/application.html.erb
Expand Up @@ -9,7 +9,7 @@
</head>
<body>
<div id="siteholder">
<h1><%= link_to 'Anmitsu', root_url.as_ssl, :id => 'logo-link' %></h1>
<h1><%= link_to 'Anmitsu', root_url, :id => 'logo-link' %></h1>
<h2>For your buisiness.</h2>
<div id="siteWrap">
<div class="wrapCapT">
Expand All @@ -28,8 +28,8 @@
<li><%= link_to t('Listing items'), items_path %></li>
<li><%= link_to t('Preferences'), edit_information_path(current_user.information), :id => 'preferences_link' %></li>
<% else %>
<li><%= link_to t('Sign up'), new_user_registration_url.as_ssl, :id => 'sign-up-link' %></li>
<li><%= link_to t('Sign in'), new_user_session_url.as_ssl, :id => 'sign-in-link' %></li>
<li><%= link_to t('Sign up'), new_user_registration_url, :id => 'sign-up-link' %></li>
<li><%= link_to t('Sign in'), new_user_session_url, :id => 'sign-in-link' %></li>
<% end %>
</ul>
</div>
Expand Down
28 changes: 11 additions & 17 deletions config/routes.rb
@@ -1,27 +1,21 @@
Anmitsu::Application.routes.draw do
class ForceSSL
def self.matches?(request)
Rails.env != 'production' || request.ssl?
end
end

get :tos, :to => "root#tos"
get :contact, :to => "root#contact"
root :to => "root#index"
scope :constraints => ForceSSL do
resources :clients, :only => [:index]
resources :information, :only => [:edit, :update]
resources :accounts, :only => [:show]
resources :items do
resources :accounts, :only => [:create, :destroy]
end
devise_for :users, :controllers => {:sessions => 'users/sessions', :confirmations => 'users/confirmations', :registrations => 'users'} do
namespace :users do
get :registered
end

resources :clients, :only => [:index]
resources :information, :only => [:edit, :update]
resources :accounts, :only => [:show]
resources :items do
resources :accounts, :only => [:create, :destroy]
end
devise_for :users, :controllers => {:sessions => 'users/sessions', :confirmations => 'users/confirmations', :registrations => 'users'} do
namespace :users do
get :registered
end
end


# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
7 changes: 0 additions & 7 deletions lib/ext/string/as_ssl.rb

This file was deleted.

0 comments on commit 59e05d2

Please sign in to comment.