Class: Signup::EmailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Signup::EmailController
- Defined in:
- app/controllers/signup/email_controller.rb
Overview
メール認証情報サインアップ
Constant Summary collapse
- EditFormClass =
EmailCredentialEditForm
Instance Method Summary collapse
-
#activate ⇒ Object
POST /signup/email/activate FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く.
-
#activated ⇒ Object
GET /signup/email/activated FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く.
-
#activation ⇒ Object
GET /signup/email/activation/:activation_token FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く.
-
#create ⇒ Object
POST /signup/email/create.
-
#created ⇒ Object
GET /signup/email/created.
-
#index ⇒ Object
GET /signup/email.
-
#validate ⇒ Object
POST /signup/email/validate.
-
#validated ⇒ Object
GET /signup/email/validated.
Instance Method Details
#activate ⇒ Object
POST /signup/email/activate FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'app/controllers/signup/email_controller.rb', line 89 def activate @credential = EmailCredential.find_by_activation_token(params[:activation_token]) unless @credential set_error(p_("MultiAuth", "It is an invalid activation key.")) redirect_to(root_path) return end if @credential.activated? set_error(p_("MultiAuth", "This email address has been already registered.")) redirect_to(root_path) return end @credential.activate! # TODO: テスト # MEMO: 即時性を優先し、非同期化しない ActivationMailer.deliver_complete_for_signup( :recipients => @credential.email) redirect_to(:action => "activated") end |
#activated ⇒ Object
GET /signup/email/activated FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く
117 118 119 |
# File 'app/controllers/signup/email_controller.rb', line 117 def activated # nop end |
#activation ⇒ Object
GET /signup/email/activation/:activation_token FIXME: URLの見直し FIXME: 無効なアクティベーションキー、アクティベーション済みのキーはフィルタで弾く
81 82 83 84 |
# File 'app/controllers/signup/email_controller.rb', line 81 def activation @credential = EmailCredential.find_by_activation_token(params[:activation_token]) @activated = @credential.try(:activated?) end |
#create ⇒ Object
POST /signup/email/create
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/signup/email_controller.rb', line 45 def create @signup_form = EditFormClass.new(session[:signup_form]) @user = MultiAuth.user_model_class.new @credential = @user.email_credentials.build @credential.attributes = @signup_form.to_email_credential_hash if @signup_form.valid? && @user.save @activation_url = url_for( :only_path => false, :controller => "signup/email", :action => "activation", :activation_token => @credential.activation_token) # TODO: テスト # MEMO: 即時性を優先し、非同期化しない ActivationMailer.deliver_request_for_signup( :recipients => @credential.email, :activation_url => @activation_url) redirect_to(:action => "created") else set_error_now(p_("MultiAuth", "Please confirm your input.")) render(:action => "index") end end |
#created ⇒ Object
GET /signup/email/created
73 74 75 76 |
# File 'app/controllers/signup/email_controller.rb', line 73 def created @signup_form = EditFormClass.new(session[:signup_form]) @credential = EmailCredential.find_by_email(@signup_form.email) end |
#index ⇒ Object
GET /signup/email
13 14 15 |
# File 'app/controllers/signup/email_controller.rb', line 13 def index @signup_form = EditFormClass.new end |
#validate ⇒ Object
POST /signup/email/validate
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/signup/email_controller.rb', line 18 def validate @signup_form = EditFormClass.new(params[:signup_form]) if @signup_form.valid? session[:signup_form] = @signup_form.attributes redirect_to(:action => "validated") else @signup_form.password = nil @signup_form.password_confirmation = nil set_error_now(p_("MultiAuth", "Please confirm your input.")) render(:action => "index") end end |
#validated ⇒ Object
GET /signup/email/validated
33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/signup/email_controller.rb', line 33 def validated @signup_form = EditFormClass.new(session[:signup_form]) if @signup_form.valid? render else set_error_now(p_("MultiAuth", "Please confirm your input.")) render(:action => "index") end end |