Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now overriding new method for devise::sessions to prevent redirect lo…

…op on is_active check
  • Loading branch information...
commit 96a11384a4c863ea0639c6eb4b9b538078a78063 1 parent e283e6d
@gmcmillan authored
View
8 app/controllers/application_controller.rb
@@ -1,11 +1,17 @@
class ApplicationController < ActionController::Base
protect_from_forgery
+ before_filter :set_timezone
before_filter :authenticate_user!
- before_filter :kick_user_if_not_active, :unless => :devise_controller?
+ #before_filter :kick_user_if_not_active, :unless => :devise_controller?
+ before_filter :kick_user_if_not_active
helper_method :is_admin?, :is_active?
+ def set_timezone
+ Time.zone = 'Pacific Time (US & Canada)'
+ end
+
protected
def is_admin?
View
8 app/controllers/sessions_controller.rb
@@ -0,0 +1,8 @@
+class SessionsController < Devise::SessionsController
+
+ skip_before_filter :kick_user_if_not_active
+
+ def new
+ end
+
+end
View
2  app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
View
2  app/models/user.rb
@@ -2,7 +2,7 @@ class User < ActiveRecord::Base
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
- attr_accessible :password, :password_confirmation, :remember_me
+ attr_accessible :email, :password, :password_confirmation, :remember_me
attr_accessor :accessible
private
View
6 app/views/layouts/application.html.erb
@@ -9,11 +9,13 @@
<body>
<div id="container">
+
<% flash.each do |key, msg| %>
<div id="<%= key %>">
- <p><%= msg %></p>
+ <%= msg %>
</div>
<% end %>
+
<div id="login_information">
<% if user_signed_in? && is_active? %>
Logged in: <%= link_to current_user.email, edit_user_registration_path %> || <%= link_to "Logout?", destroy_user_session_path, :confirm => 'Are you sure?' %><br />
@@ -25,4 +27,4 @@
</div>
</body>
-</html>
+</html>
View
0  app/views/user/sessions/new.html.erb → app/views/sessions/new.html.erb
File renamed without changes
View
2  config/routes.rb
@@ -1,7 +1,7 @@
Webcore::Application.routes.draw do
devise_for :user, :skip => [:sessions, :registrations] do
- get 'login' => 'devise/sessions#new', :as => :new_user_session
+ get 'login' => 'sessions#new', :as => :new_user_session
post 'login' => 'devise/sessions#create', :as => :user_session
get 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
View
7 public/stylesheets/style.css
@@ -49,8 +49,8 @@ a:hover {
}
#notice, #alert {
- width: 50%;
- margin: 0 auto 10px auto;
+ width: 100%;
+ margin: 0 auto 0 auto;
padding: 5px;
}
@@ -81,6 +81,8 @@ a:hover {
border: 1px solid #333;
}
+
+
/* error explanations for forms */
#error_explanation {
@@ -115,6 +117,7 @@ a:hover {
}
+
/* table styling */
table {
View
8 test/functional/sessions_controller_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class SessionsControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
View
4 test/unit/helpers/sessions_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class SessionsHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.