Sha256: 3b97de063db15e6c9941b26fd5870c648b2e0a0609516f635118e45704c996bf
Contents?: true
Size: 1.18 KB
Versions: 6
Compression:
Stored size: 1.18 KB
Contents
class Clearance::ConfirmationsController < ApplicationController unloadable before_filter :forbid_confirmed_user, :only => :new before_filter :forbid_missing_token, :only => :new before_filter :forbid_non_existent_user, :only => :new filter_parameter_logging :token def new create end def create @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) @user.confirm_email! sign_user_in(@user) flash[:success] = translate(:confirmed_email, :scope => [:clearance, :controllers, :confirmations], :default => "Confirmed email and signed in.") redirect_to url_after_create end private def forbid_confirmed_user user = ::User.find_by_id(params[:user_id]) if user && user.email_confirmed? raise ActionController::Forbidden, "confirmed user" end end def forbid_missing_token if params[:token].blank? raise ActionController::Forbidden, "missing token" end end def forbid_non_existent_user unless ::User.find_by_id_and_token(params[:user_id], params[:token]) raise ActionController::Forbidden, "non-existent user" end end def url_after_create root_url end end
Version data entries
6 entries across 6 versions & 3 rubygems