Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
helpers Activate::ParamHelpers
helpers Activate::NavigationHelpers

enable :sessions

if ENV['SSL']
use Rack::SslEnforcer
use Rack::Session::Cookie, :key => '_rack_session', :path => '/', :expire_after => 30*24*60*60, :secret => ENV['SESSION_SECRET']
else
set :sessions, :expire_after => 1.year
end

def initialize
unless ActiveRecord::Base.connection.active?
unless ActiveRecord::Base.connection.active? || ActiveRecord::Base.connection_pool.active_connection?

Check warning

Code scanning / Rubocop (reported by Codacy)

Limit lines to 80 characters. Warning

Line is too long. [107/80]
if ENV['DATABASE_URL'] and ENV['DATABASE_SCHEMA']
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
ActiveRecord::Base.connection.schema_search_path = ENV['DATABASE_SCHEMA']
Expand Down Expand Up @@ -410,7 +405,7 @@
if account = Account.authenticate(params[:email], params[:password])
session[:account_id] = account.id
flash[:notice] = "Logged in successfully."
redirect url(:home)
redirect params[:redir] or url(:home)

Check warning

Code scanning / Rubocop (reported by Codacy)

Use &&/|| instead of and/or. Warning

Use || instead of or.
elsif Padrino.env == :development && params[:bypass]
account = Account.first
session[:account_id] = account.id
Expand Down
4 changes: 4 additions & 0 deletions app/views/login.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

<% form_tag url(:login), :class => 'form-horizontal' do %>

<% if params[:redir] %>
<%= hidden_field_tag :redir, :value => params[:redir] %>
<% end %>

<div class="form-group">
<label class="control-label col-sm-3">Email</label>
<div class="col-sm-3">
Expand Down
Loading