Stopgap measure in making logins explicit #145

Merged
merged 4 commits into from Aug 9, 2013
@@ -27,6 +27,9 @@ body.landing #top-bar
width: 750px
margin: 50px auto
margin-top: 90px
+ #share-alert
+ font-size: 1.5em
+ margin-bottom: 30px
#banner
img
margin: 30px 0
@@ -13,7 +13,15 @@ class ApplicationController < ActionController::Base
private
def authenticate
- current_authorization || (store_location && redirect_to(login_path))
+ return if current_authorization
+
+ store_location
+ redirect_on_auth_failure
+ end
+
+ def redirect_on_auth_failure
+ flash[:notice] = "That page is protected. Please sign in or sign up to continue"
+ redirect_to(root_path)
end
def authenticate_user
@@ -95,6 +95,11 @@ def coupon_valid
private
+ # Called by ApplicationController#authenticate
+ def redirect_on_auth_failure
+ redirect_to login_path
+ end
+
def ye_shall_not_pass
if current_user && current_user.status == "active"
redirect_to root_path, :notice => "Your account is already setup."
@@ -3,6 +3,7 @@ class SessionsController < ApplicationController
skip_before_filter :authenticate_user
def new
+ mixpanel.track("Github auth")
redirect_to '/auth/github'
end
@@ -3,6 +3,8 @@
%li= link_to "Sign in", login_path
#landing
+ - if flash[:notice]
+ #share-alert= flash[:notice]
#banner
%h1 Practicing Ruby
%h2 Delightful coding lessons published monthly
@@ -46,6 +46,7 @@ class BroadcastMessagesTest < ActionDispatch::IntegrationTest
private
def send_message(options = {})
+ sign_user_in
visit new_admin_broadcast_path
fill_in 'to', :with => options[:to] if options[:to]
@@ -55,4 +56,4 @@ def send_message(options = {})
click_button options[:button] || "Send"
end
-end
+end