Class: Signup::OpenIdController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Signup::OpenIdController
- Defined in:
- app/controllers/signup/open_id_controller.rb
Overview
OpenID認証情報サインアップ FIXME: 全体的に実装を整理
Instance Method Summary collapse
-
#authenticate ⇒ Object
POST /signup/open_id/authenticate GET /signup/open_id/authenticate.
-
#authenticated ⇒ Object
GET /signup/open_id/authenticated.
-
#create ⇒ Object
POST /signup/open_id/create.
-
#created ⇒ Object
GET /signup/open_id/created.
-
#index ⇒ Object
GET /signup/open_id.
Instance Method Details
#authenticate ⇒ Object
POST /signup/open_id/authenticate GET /signup/open_id/authenticate
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/signup/open_id_controller.rb', line 14 def authenticate @openid_url = params[:openid_url] failed = proc { || flash[:error] = redirect_to(:action => "index") } authenticate_with_open_id(@openid_url) { |result, identity_url, sreg| if result.successful? if OpenIdCredential.exists?(:identity_url => identity_url) failed[p_("MultiAuth", "Because specified OpenID has already been registered, " + "it is not possible to use it. ")] else session[:identity_url] = identity_url redirect_to(:action => "authenticated") end else failed[result.] end } end |
#authenticated ⇒ Object
GET /signup/open_id/authenticated
39 40 41 |
# File 'app/controllers/signup/open_id_controller.rb', line 39 def authenticated @identity_url = session[:identity_url] end |
#create ⇒ Object
POST /signup/open_id/create
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/signup/open_id_controller.rb', line 44 def create @identity_url = session[:identity_url] @user = MultiAuth.user_model_class.new @credential = @user.open_id_credentials.build @credential.identity_url = @identity_url @user.save! # FIXME: ログイン状態にしないように変更 session[:identity_url] = nil session[:user_id] = @user.id redirect_to(:action => "created") end |
#created ⇒ Object
GET /signup/open_id/created
61 62 63 |
# File 'app/controllers/signup/open_id_controller.rb', line 61 def created # nop end |
#index ⇒ Object
GET /signup/open_id
7 8 9 10 |
# File 'app/controllers/signup/open_id_controller.rb', line 7 def index session[:identity_url] = nil @openid_url = nil end |