Commit c1bb87b1ee5d2b2ab4b1e86abbd14d3a400e1f9c

openid specs pass, yay
renaming openid migration number

Commit diff

app/controllers/sessions_controller.rb

 
3131 if result.successful?
3232 @user = User.find_or_initialize_by_identity_url(identity_url)
3333 if @user.new_record?
34 @user.login = registration['nickname']
35 @user.fullname = registration['fullname']
36 @user.email = registration['email']
34 @user.login = registration[:nickname]
35 @user.fullname = registration[:fullname]
36 @user.email = registration[:email]
3737 @user.save!
3838 @user.activate
3939 end
toggle raw diff

db/migrate/027_add_open_id_authentication_tables.rb

 
1class AddOpenIdAuthenticationTables < ActiveRecord::Migration
2 def self.up
3 create_table :open_id_authentication_associations, :force => true do |t|
4 t.integer :issued, :lifetime
5 t.string :handle, :assoc_type
6 t.binary :server_url, :secret
7 end
8
9 create_table :open_id_authentication_nonces, :force => true do |t|
10 t.integer :timestamp, :null => false
11 t.string :server_url, :null => true
12 t.string :salt, :null => false
13 end
14 end
15
16 def self.down
17 drop_table :open_id_authentication_associations
18 drop_table :open_id_authentication_nonces
19 end
20end
toggle raw diff

spec/controllers/sessions_controller_spec.rb

 
11require File.dirname(__FILE__) + '/../spec_helper'
2include OpenIdAuthentication
23
34describe SessionsController do
45
2222 identity_url = "http://patcito.myopenid.com"
2323 controller.stub!(:using_open_id?).and_return(true)
2424 controller.stub!(:successful?).and_return(true)
25 controller.stub!(:authenticate_with_open_id).and_yield(result="successfull",identity_url,{:nickname=>"patcito",:email=>"patcito@gmail.com",:fullname=>'Patrick Aljord'})
25 controller.stub!(:authenticate_with_open_id).and_yield(Result[:successful],identity_url,registration={:nickname=>"patcito",:email=>"patcito@gmail.com",:fullname=>'Patrick Aljord'})
26 post :create, :openid_url => identity_url
2627 session[:user_id].should_not be(nil)
2728 response.should be_redirect
2829 end
toggle raw diff