Sha256: abd60504b4f5a49ccc2be505747a6f81d214fb8f0c047401d91a769474bfeadd

Contents?: true

Size: 748 Bytes

Versions: 46

Compression:

Stored size: 748 Bytes

Contents

module Incline
  class AccountActivationsController < ApplicationController

    require_anon true

    ##
    # GET /incline/activate/activation-token?email=user@example.com
    def edit
      if logged_in?
        flash[:danger] = 'You cannot reactivate your account.'
        redirect_to main_app.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 main_app.root_url
        end
      end
    end

  end

end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
incline-0.2.6 app/controllers/incline/account_activations_controller.rb
incline-0.2.5 app/controllers/incline/account_activations_controller.rb
incline-0.2.4 app/controllers/incline/account_activations_controller.rb
incline-0.2.3 app/controllers/incline/account_activations_controller.rb
incline-0.1.9 app/controllers/incline/account_activations_controller.rb
incline-0.1.8 app/controllers/incline/account_activations_controller.rb