Class: Credentials::EmailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Credentials::EmailController
- Defined in:
- app/controllers/credentials/email_controller.rb
Overview
メール認証情報コントローラ
Constant Summary collapse
- EditFormClass =
EmailCredentialEditForm
Instance Method Summary collapse
-
#activate ⇒ Object
POST /credential/email/token/:activation_token/activate.
-
#activated ⇒ Object
GET /credential/email/token/:activation_token/activated.
-
#activation ⇒ Object
GET /credential/email/token/:activation_token/activation.
-
#create ⇒ Object
GET /credentials/email/create.
-
#created ⇒ Object
GET /credential/email/:email_credential_id/created.
-
#delete ⇒ Object
GET /credential/email/:email_credential_id/delete.
-
#destroy ⇒ Object
POST /credential/email/:email_credential_id/destroy.
-
#edit_password ⇒ Object
GET /credential/email/:email_credential_id/edit_password.
-
#new ⇒ Object
GET /credentials/email/new.
-
#update_password ⇒ Object
POST /credential/email/:email_credential_id/update_password.
Instance Method Details
#activate ⇒ Object
POST /credential/email/token/:activation_token/activate
97 98 99 100 101 102 103 104 105 106 |
# File 'app/controllers/credentials/email_controller.rb', line 97 def activate @email_credential.activate! # TODO: テスト # MEMO: 即時性を優先し、非同期化しない ActivationMailer.deliver_complete_for_credential( :recipients => @email_credential.email) redirect_to(:action => "activated") end |
#activated ⇒ Object
GET /credential/email/token/:activation_token/activated
109 110 111 |
# File 'app/controllers/credentials/email_controller.rb', line 109 def activated # nop end |
#activation ⇒ Object
GET /credential/email/token/:activation_token/activation
92 93 94 |
# File 'app/controllers/credentials/email_controller.rb', line 92 def activation # nop end |
#create ⇒ Object
GET /credentials/email/create
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/credentials/email_controller.rb', line 21 def create @edit_form = EditFormClass.new(params[:edit_form]) @email_credential = @login_user.email_credentials.build @email_credential.attributes = @edit_form.to_email_credential_hash if @edit_form.valid? && @email_credential.save # TODO: テスト @activation_url = url_for( :only_path => false, :controller => "credentials/email", :action => "activation", :activation_token => @email_credential.activation_token) # TODO: テスト # MEMO: 即時性を優先し、非同期化しない ActivationMailer.deliver_request_for_credential( :recipients => @email_credential.email, :activation_url => @activation_url) set_notice(p_("MultiAuth", "Email authentication credential was successfully added.")) redirect_to(:action => "created", :email_credential_id => @email_credential.id) else @edit_form.password = nil @edit_form.password_confirmation = nil set_error_now(p_("MultiAuth", "Please confirm your input.")) render(:action => "new") end end |
#created ⇒ Object
GET /credential/email/:email_credential_id/created
52 53 54 |
# File 'app/controllers/credentials/email_controller.rb', line 52 def created # nop end |
#delete ⇒ Object
GET /credential/email/:email_credential_id/delete
79 80 81 |
# File 'app/controllers/credentials/email_controller.rb', line 79 def delete # nop end |
#destroy ⇒ Object
POST /credential/email/:email_credential_id/destroy
84 85 86 87 88 89 |
# File 'app/controllers/credentials/email_controller.rb', line 84 def destroy @email_credential.destroy set_notice(p_("MultiAuth", "Email authentication credential was successfully deleted.")) redirect_to(:controller => "/credentials") end |
#edit_password ⇒ Object
GET /credential/email/:email_credential_id/edit_password
57 58 59 |
# File 'app/controllers/credentials/email_controller.rb', line 57 def edit_password @edit_form = PasswordEditForm.new end |
#new ⇒ Object
GET /credentials/email/new
16 17 18 |
# File 'app/controllers/credentials/email_controller.rb', line 16 def new @edit_form = EditFormClass.new end |
#update_password ⇒ Object
POST /credential/email/:email_credential_id/update_password
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/credentials/email_controller.rb', line 62 def update_password @edit_form = PasswordEditForm.new(params[:edit_form]) @email_credential.attributes = @edit_form.to_credential_hash if @edit_form.valid? && @email_credential.save set_notice(p_("MultiAuth", "Password was changed.")) redirect_to(:controller => "/credentials") else @edit_form.password = nil @edit_form.password_confirmation = nil set_error_now(p_("MultiAuth", "Please confirm your input.")) render(:action => "edit_password") end end |