Commit e68e20e4 by Thanh Hung Pham

update

parent 7dc1c878
class ConfirmationsController < Devise::ConfirmationsController class ConfirmationsController < Devise::ConfirmationsController
def update_confirm def update_confirm
@user = User.find(params[:id]) @user = User.find(params[:user][:id])
if @user.save if @user.save
set_flash_message!(:notice, :confirmed) set_flash_message!(:notice, :confirmed)
redirect_to edit_user_registration_path(resource_name, resource) redirect_to edit_user_registration_path(resource_name, resource)
...@@ -10,7 +10,7 @@ class ConfirmationsController < Devise::ConfirmationsController ...@@ -10,7 +10,7 @@ class ConfirmationsController < Devise::ConfirmationsController
end end
# GET /resource/confirmation?confirmation_token=abcdef # GET /resource/confirmation?confirmation_token=abcdef
def show def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token]) self.resource = resource_class.confirm_by_token(params[:confirmation_token])
yield resource if block_given? yield resource if block_given?
...@@ -20,11 +20,16 @@ def show ...@@ -20,11 +20,16 @@ def show
else else
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new } respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
end end
end end
protected protected
def after_confirmation_path_for(resource_name, resource) def after_confirmation_path_for(resource_name, resource)
render 'devise/confirmations/information', resource: resource render 'devise/confirmations/information', resource: resource
end end
private
def user_params
params.requires(:user).permit(:email, :fullname, :password, :cd_name)
end
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="well"> <div class="well">
<h2>Register</h2> <h2>Register</h2>
<%= form_for(resource, url: confirmations_update_confirm_path, html: { method: :post }) do |f| %> <%= form_for(resource, url: confirmations_update_confirm_path(resource), html: { method: :post }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="form-group"> <div class="form-group">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment