Sunday, 15 January 2012

login - Log in user after accept invitation using rails with devise_invitable -



login - Log in user after accept invitation using rails with devise_invitable -

i utilize devise_invitable rails , need help. want create user logged in after take invitation. here invitationscontroller

class invitationscontroller < devise::invitationscontroller def update if user.accept_invitation!(user_params) # log in user here redirect_to dashboard_show_path, notice: t('invitaion.accepted') else redirect_to root_path, error: t('invitation.not_accepted') end end private def user_params params.require(:user).permit(:invitation_token, :password, :password_confirmation) end end

you can see comment in code

# log in user here

here want log in user has take invitation.

thanks.

the method looking sign_in, seek this:

def update if user.accept_invitation!(user_params) sign_in(params[:user]) redirect_to dashboard_show_path, notice: t('invitaion.accepted') else redirect_to root_path, error: t('invitation.not_accepted') end end

however should note devise_invitable, default, signs in users after have accepted invitation. see default update action here, if wish utilize default functionality phone call super method or don't implement update action @ all.

ruby-on-rails login devise devise-invitable

No comments:

Post a Comment