Sha256: b09fc10d6f9da6ffe99388b39665f476aeeebaed9654dda4b68b4b43e03565a3
Contents?: true
Size: 937 Bytes
Versions: 2
Compression:
Stored size: 937 Bytes
Contents
## # This is a simple controller that handles account activation requests. # class AccountActivationsController < ApplicationController ## # Takes in the user's email address and activation token as parameters. # # If the activation token is correct for the email, then the account is activated. # If a user is logged in, then the user must be activated already, so alert them that reactivation is not allowed. def edit if logged_in? flash[:danger] = 'You cannot reactivate your account.' redirect_to root_url else user = User.find_by(email: params[:email].downcase) if user && !user.activated? && user.authenticated?(:activation, params[:id]) user.activate log_in user flash[:success] = 'Your account has been activated.' redirect_to user else flash[:danger] = 'Invalid activation link' redirect_to root_url end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
barkest_core-1.5.4.0 | app/controllers/account_activations_controller.rb |
barkest_core-1.5.3.0 | app/controllers/account_activations_controller.rb |