Permalink
Browse files

updated to work with version 0.0.36

  • Loading branch information...
1 parent 7111583 commit ff7edc6da6e52cecd05fbb0051f05b45cdeb623d @lancejpollard committed May 27, 2010
View
6 app/controllers/users_controller.rb
@@ -2,6 +2,11 @@ class UsersController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => [:show, :edit, :update]
before_filter :admin_only, :only => :detonate
+ before_filter :show_sesh
+
+ def show_sesh
+ #puts "SESH: #{session.inspect}"
+ end
def new
@user = User.new
@@ -43,6 +48,7 @@ def update
# for debugging...
def detonate
+ session.clear
User.all.collect(&:destroy)
redirect_to signup_url
end
View
3 app/views/user_sessions/new.html.haml
@@ -1,7 +1,8 @@
%h2 Login!
%form#authentication_form{:action => authenticate_url, :method => :post}
%fieldset
- %input{:type => :hidden, :name => :login_with_oauth, :value => "oauth"}
+ %input{:type => :hidden, :name => :authentication_method, :value => :oauth}
+ %input{:type => :hidden, :name => :authentication_type, :value => :session}
%legend Click your Oauth or OpenID provider.
.oauth_providers
%ul
View
17 app/views/users/_new.html.haml
@@ -1,17 +0,0 @@
-%h2 Login or Register!
-%form#authentication_form{:action => "/users", :method => :post}
- %fieldset
- %input{:type => :hidden, :name => :register_with_oauth}
- %legend Click your Oauth or OpenID provider.
- .oauth_providers
- %ul
- - %w(google facebook twitter).each do |name|
- %li.oauth_provider
- %img{:src => "/images/icons/#{name}.png"}
- %input{:type => :radio, :id => "#{name}_oauth_provider", :name => :oauth_provider, :value => name}
- .clearfix
- %fieldset
- %legend Or type in your OpenID address
- .openid_address
- %input.nice{:type => :text, :name => "openid_identifier"}
- %input.submit{:name => :submit, :type => :submit, :value => "Subscribe"}/
View
4 app/views/users/edit.html.haml
@@ -1,7 +1,7 @@
%h2 My Account
-%form#authentication_form{:action => connected_path, :method => :put}
+%form#authentication_form{:action => connected_path, :method => :post}
%fieldset
- %input{:type => :hidden, :name => :register_with_oauth, :value => "oauth"}
+ %input{:type => :hidden, :name => :authentication_type, :value => :user}
%input{:type => :hidden, :name => :_method, :value => :put}
%legend Add another Oauth or OpenID provider.
.oauth_providers
View
3 app/views/users/new.html.haml
@@ -1,7 +1,8 @@
%h2 Login or Register!
%form#authentication_form{:action => register_url, :method => :post}
%fieldset
- %input{:type => :hidden, :name => :register_with_oauth, :value => "oauth"}
+ / authentication_type should be "user" or "session", based on controller
+ %input{:type => :hidden, :name => :authentication_type, :value => :user}
%legend Click your Oauth or OpenID provider.
.oauth_providers
%ul
View
3 config/environment.rb
@@ -30,7 +30,7 @@
config.gem "oauth"
config.gem "oauth2" # facebook only
config.gem "authlogic-connect"
-
+
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
@@ -72,3 +72,4 @@
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
end
+OpenIdAuthentication.store = :file
View
1 config/routes.rb
@@ -11,4 +11,5 @@
map.resource :user_session
map.profile ':id', :controller => :users, :action => :show
+ map.root :controller => 'users'
end
View
1 db/migrate/20100506020514_create_users.rb
@@ -14,7 +14,6 @@ def self.up
t.string :last_login_ip
t.string :current_login_ip
# authlogic-connect
- t.string :openid_identifier # should be a token, later...
t.integer :active_token_id
end
View
4 db/migrate/20100506020520_create_tokens.rb
@@ -3,13 +3,15 @@ def self.up
create_table :tokens do |t|
t.integer :user_id
t.string :type, :limit => 30
- t.string :key, :limit => 1024 # This has to be huge because of Yahoo's excessively large tokens
+ t.string :key # how we identify the user, in case they logout and log back in
+ t.string :token, :limit => 1024 # This has to be huge because of Yahoo's excessively large tokens
t.string :secret
t.boolean :active # whether or not it's associated with the account
t.timestamps
end
add_index :tokens, :key, :unique
+ add_index :tokens, :token, :unique
end
def self.down
View
5 db/schema.rb
@@ -24,14 +24,16 @@
create_table "tokens", :force => true do |t|
t.integer "user_id"
t.string "type", :limit => 30
- t.string "key", :limit => 1024
+ t.string "key"
+ t.string "token", :limit => 1024
t.string "secret"
t.boolean "active"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "tokens", ["key"], :name => "index_tokens_on_key", :unique => true
+ add_index "tokens", ["token"], :name => "index_tokens_on_token", :unique => true
create_table "users", :force => true do |t|
t.datetime "created_at"
@@ -46,7 +48,6 @@
t.datetime "current_login_at"
t.string "last_login_ip"
t.string "current_login_ip"
- t.string "openid_identifier"
t.integer "active_token_id"
end

0 comments on commit ff7edc6

Please sign in to comment.