Sha256: 0127065e1e45d3a4b359f5abc4862ed287e193217c507d39ec48f7374827c81d

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 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 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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
incline-0.1.7 app/controllers/incline/account_activations_controller.rb
incline-0.1.5 app/controllers/incline/account_activations_controller.rb