Permalink
Browse files

Removing ssl_requirement gem

Causing trouble while not needed anymore, as we now have SSL activated by
default.
  • Loading branch information...
1 parent 2a6b19b commit a419bc33af0001b7ce8ff0d7d49102f327bef072 @tsujigiri tsujigiri committed Feb 9, 2014
View
@@ -5,7 +5,6 @@ gem 'authlogic' # lots of user-related magic
gem 'i18n', '>= 0.6.6'
gem 'rails3-generators'
gem "jquery-rails"
-gem 'bartt-ssl_requirement', '~>1.4.0', :require => 'ssl_requirement'
gem 'vegas'
gem 'bcrypt-ruby', :require => "bcrypt"
gem 'sanitize'
View
@@ -104,7 +104,6 @@ GEM
authlogic (3.3.0)
activerecord (>= 3.2)
activesupport (>= 3.2)
- bartt-ssl_requirement (1.4.2)
bcrypt-ruby (3.1.2)
bourbon (3.1.8)
sass (>= 3.2.0)
@@ -334,7 +333,6 @@ DEPENDENCIES
activeadmin (= 0.6.0)
activerecord-import (~> 0.2.11)
authlogic
- bartt-ssl_requirement (~> 1.4.0)
bcrypt-ruby
capistrano (~> 2.0)
coffee-script
@@ -2,13 +2,9 @@ class ApplicationController < ActionController::Base
protect_from_forgery
helper :all
helper_method :current_user_session, :current_user
- if Rails.env.production?
- include ::SslRequirement
- ssl_allowed :all
- end
def not_found
- raise ActionController::RoutingError.new("Not found")
+ raise ActionController::RoutingError.new("Not found")
end
private
@@ -1,28 +1,25 @@
class UserSessionsController < ApplicationController
- before_filter :require_no_user, :only => [:new, :create]
- before_filter :require_user, :only => :destroy
- if Rails.env.production?
- ssl_required :create, :new, :destroy
- end
+ before_filter :require_no_user, :only => [:new, :create]
+ before_filter :require_user, :only => :destroy
- def new
- @user_session = UserSession.new
- @title = "Login"
- end
+ def new
+ @user_session = UserSession.new
+ @title = "Login"
+ end
- def create
- @user_session = UserSession.new(params[:user_session])
- if @user_session.save
- flash[:notice] = "Login successful!"
- redirect_to @user_session.user
- else
- render :action => :new
- end
- end
+ def create
+ @user_session = UserSession.new(params[:user_session])
+ if @user_session.save
+ flash[:notice] = "Login successful!"
+ redirect_to @user_session.user
+ else
+ render :action => :new
+ end
+ end
- def destroy
- current_user_session.destroy
- flash[:notice] = "Logout successful!"
- redirect_to root_url
- end
+ def destroy
+ current_user_session.destroy
+ flash[:notice] = "Logout successful!"
+ redirect_to root_url
+ end
end
@@ -4,10 +4,6 @@ class UsersController < ApplicationController
before_filter :require_owner, only: [ :update, :destroy, :edit, :changepassword ]
before_filter :require_no_user, :only => [:new, :create]
- if Rails.env.production?
- ssl_allowed :index, :show, :edit, :create, :new, :update
- end
-
def new
@user = User.new
@title = "Sign up"
@@ -40,32 +36,32 @@ def index
@users = User.order(sort_column + " " + sort_direction)
@users_paginate = @users.paginate(:page => params[:page], :per_page => 10)
@title = "Listing all users"
-
+
if request.format.json?
- @result = []
- begin
+ @result = []
+ begin
@users = User.find(:all)
@users.each do |u|
- @user = {}
- @user["name"] = u.name
- @user["id"] = u.id
- @user["genotypes"] = []
- Genotype.find_all_by_user_id(u.id).each do |g|
+ @user = {}
+ @user["name"] = u.name
+ @user["id"] = u.id
+ @user["genotypes"] = []
+ Genotype.find_all_by_user_id(u.id).each do |g|
@genotype = {}
@genotype["id"] = g.id
@genotype["filetype"] = g.filetype
@genotype["download_url"] = 'http://opensnp.org/data/' + g.fs_filename
@user["genotypes"] << @genotype
- end
- @result << @user
+ end
+ @result << @user
end
- rescue
+ rescue
@result = {}
@result["error"] = "Sorry, we couldn't find any users"
- end
+ end
end
-
+
respond_to do |format|
format.html
format.json { render :json => @result }
@@ -131,12 +127,8 @@ def edit
def changepassword
@user = User.find_by_id(params[:id])
- respond_to do |format|
- format.html
- format.xml
- end
end
-
+
def update
@user = User.find(params[:id])
@@ -151,18 +143,18 @@ def update
end
end
end
-
+
if params[:user][:description].present?
- params[:user][:description] = Sanitize.clean(params[:user][:description], Sanitize::Config::RESTRICTED)
+ params[:user][:description] = Sanitize.clean(params[:user][:description], Sanitize::Config::RESTRICTED)
end
if @user.update_attributes(params[:user])
@empty_websites = Homepage.find_all_by_user_id_and_url(current_user.id,"")
@empty_websites.each do |ew| ew.delete end
-
+
Sidekiq::Client.enqueue(Recommendvariations)
Sidekiq::Client.enqueue(Recommendphenotypes)
-
+
flash[:notice] = "Successfully updated"
if params[:user][:password] or params[:user][:avatar]
@@ -173,9 +165,9 @@ def update
format.html
end
end
-
+
else
-
+
respond_to do |format|
format.html do
if request.xhr?
@@ -193,16 +185,16 @@ def check_to_create_phenotype(characteristic, variation, user_id)
# does the phenotype exist?
@phenotype = Phenotype.find_by_characteristic(characteristic)
if @phenotype == nil
- # createphenotype if it doesn't exist
- @phenotype = Phenotype.create(:characteristic => characteristic, :number_of_users => 1)
+ # createphenotype if it doesn't exist
+ @phenotype = Phenotype.create(:characteristic => characteristic, :number_of_users => 1)
end
@user_phenotype = UserPhenotype.find_by_phenotype_id(@phenotype.id)
if @user_phenotype == nil
- # create user_phenotype if it doesn't exist
- @user_phenotype = UserPhenotype.create(:user_id => user_id, :variation => variation, :phenotype_id => @phenotype.id)
+ # create user_phenotype if it doesn't exist
+ @user_phenotype = UserPhenotype.create(:user_id => user_id, :variation => variation, :phenotype_id => @phenotype.id)
else
- # if user_phenotype exists, update
- @user_phenotype.update_attributes(:variation => variation)
+ # if user_phenotype exists, update
+ @user_phenotype.update_attributes(:variation => variation)
end
end
@@ -212,12 +204,12 @@ def destroy
@user.genotypes.each do |ug|
ug.destroy
end
-
+
flash[:notice] = "Thank you for using openSNP. Goodbye!"
# disconnect from fitbit if needed
if @user.fitbit_profile != nil
- Sidekiq::Client.enqueue(FitbitEndSubscription, @user.fitbit_profile.id)
+ Sidekiq::Client.enqueue(FitbitEndSubscription, @user.fitbit_profile.id)
end
@user.destroy
@@ -230,15 +222,15 @@ def destroy
def remove_help_one
current_user.update_attribute("help_one",true)
end
-
+
def remove_help_two
current_user.update_attribute("help_two",true)
end
-
+
def remove_help_three
current_user.update_attribute("help_three",true)
end
-
+
private
def sort_column
@@ -122,7 +122,7 @@
# Options to be passed to the created cookie. For instance, you can set
# :secure => true in order to force SSL only cookies.
- # config.rememberable_options = {}
+ config.rememberable_options = { secure: true }
# ==> Configuration for :validatable
# Range for password length. Default is 8..128.

0 comments on commit a419bc3

Please sign in to comment.