Permalink
Browse files

Updates to work with current Rails and Devise as of their re-write to…

… 2.0.0 and above
  • Loading branch information...
1 parent defae1b commit cf1de2b06909fa580742bb6c1a67b70bb869ec58 Christian Frichot committed Apr 6, 2012
View
21 README.rdoc
@@ -7,16 +7,33 @@ This is a devise[https://github.com/plataformatec/devise] extension to allow you
* Version 0.2 - tidied up some of the code - changed the references to AsteriskLabs
* Version 0.3 - first working version! With working generators, tests, and doesnt require changes to Devise's Sign In view
* Version 0.3.1 - Slight updated in the dependencies.
+* Version 0.3.2 - Updated to include support for Devise 2.0.0 and above (no longer supports 1.5.3 or lower), you'll need version 0.3.1 to use older Devise
== Installation
Add the gem to your Gemfile (don't forget devise too):
-* gem 'devise', '~> 1.5.3'
-* gem 'devise_google_authenticator', '0.3.1'
+* gem 'devise'
+* gem 'devise_google_authenticator', '0.3.2'
Don't forget to "bundle install"
+=== Devise Installation (In case you haven't done it)
+
+To setup Devise, you need to do the following (but refer to https://github.com/plataformatec/devise for more information)
+
+Install Devise:
+* rails g devise:install
+
+Setup the User or Admin model
+* rails g devise MODEL
+
+Configure your app for authorisation, edit your Controller and add this before_filter:
+
+* before_filter :authenticate_user!
+
+Make sure your "root" route is configured in config/routes.rb
+
=== Automatic Installation (Lets assume this is a bare bones app)
Run the following generator to add the necessary configuration options to Devise's config file:
View
4 app/controllers/devise/checkga_controller.rb
@@ -1,13 +1,13 @@
class Devise::CheckgaController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :show, :update ]
- include Devise::Controllers::InternalHelpers
+ include Devise::Controllers::Helpers
def show
@tmpid = params[:id]
if @tmpid.nil?
redirect_to :root
else
- render_with_scope :show
+ render :show
end
end
View
8 app/controllers/devise/displayqr_controller.rb
@@ -1,11 +1,11 @@
-class Devise::DisplayqrController < ApplicationController
+class Devise::DisplayqrController < DeviseController
prepend_before_filter :authenticate_scope!, :only => [:show,:update]
- include Devise::Controllers::InternalHelpers
+ include Devise::Controllers::Helpers
def show
if not resource.nil? and not resource.gauth_secret.nil?
- render_with_scope :show
+ render :show
else
sign_in scope, resource, :bypass => true
redirect_to stored_location_for(scope) || :root
@@ -19,7 +19,7 @@ def update
sign_in scope, resource, :bypass => true
redirect_to stored_location_for(scope) || :root
else
- render_with_scope :show
+ render :show
end
end
View
12 devise_google_authenticator.gemspec
@@ -2,9 +2,9 @@
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
Gem::Specification.new do |s|
s.name = "devise_google_authenticator"
- s.version = "0.3.1"
+ s.version = "0.3.2"
s.authors = ["Christian Frichot"]
- s.date = "2012-01-29"
+ s.date = "2012-04-06"
s.description = "Devise Google Authenticator Extension, for adding Google's OTP to your Rails apps!"
s.email = "xntrik@gmail.com"
s.extra_rdoc_files = [
@@ -20,12 +20,12 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 1.8.6'
s.required_rubygems_version = '>= 1.3.6'
- s.add_development_dependency('bundler', '~> 1.0.7')
+ s.add_development_dependency('bundler', '~> 1.1.3')
{
- 'rails' => ['>= 3.0.0', '<= 3.2.0'],
- 'devise' => ['>= 1.4.6', '< 1.6'],
- 'rotp' => ['< 1.3.2']
+ 'rails' => ['>= 3.0.0', '<= 3.3.0'],
+ 'devise' => ['>= 2.0.0', '<= 2.1.0'],
+ 'rotp' => ['<= 1.3.2']
}.each do |lib, version|
s.add_runtime_dependency(lib, *version)
end
View
6 lib/devise_google_authenticatable/patches/display_qr.rb
@@ -17,13 +17,13 @@ module DisplayQR
respond_with resource, :location => {:controller => 'displayqr', :action => 'show'}
else
- set_flash_message :notice, :inactive_signed_up, :reason => inactive_reason(resource) if is_navigational_format?
+ set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
- clean_up_passwords(resource)
- respond_with_navigational(resource) { render_with_scope :new }
+ clean_up_passwords resource
+ respond_with resource
end
end
end

0 comments on commit cf1de2b

Please sign in to comment.