Skip to content
Browse files

Revert "Revert "Ensuring constants are at root namespace inside Clear…

…ance controller" since now the controllers aren't inside of the clearance module."

This reverts commit e01d831.
  • Loading branch information...
1 parent 698050a commit 38bafd16a8d07d43942e3143c3c5c9c88c77c964 @qrush qrush committed
View
6 app/controllers/clearance/confirmations_controller.rb
@@ -11,7 +11,7 @@ def new
end
def create
- @user = User.find_by_id_and_token(params[:user_id], params[:token])
+ @user = ::User.find_by_id_and_token(params[:user_id], params[:token])
@user.confirm_email!
sign_user_in(@user)
@@ -22,7 +22,7 @@ def create
private
def forbid_confirmed_user
- user = User.find_by_id(params[:user_id])
+ user = ::User.find_by_id(params[:user_id])
if user && user.email_confirmed?
raise ActionController::Forbidden, "confirmed user"
end
@@ -35,7 +35,7 @@ def forbid_missing_token
end
def forbid_non_existent_user
- unless User.find_by_id_and_token(params[:user_id], params[:token])
+ unless ::User.find_by_id_and_token(params[:user_id], params[:token])
raise ActionController::Forbidden, "non-existent user"
end
end
View
8 app/controllers/clearance/passwords_controller.rb
@@ -10,7 +10,7 @@ def new
end
def create
- if user = User.find_by_email(params[:password][:email])
+ if user = ::User.find_by_email(params[:password][:email])
user.forgot_password!
ClearanceMailer.deliver_change_password user
flash[:notice] = "You will receive an email within the next few minutes. " <<
@@ -23,12 +23,12 @@ def create
end
def edit
- @user = User.find_by_id_and_token(params[:user_id], params[:token])
+ @user = ::User.find_by_id_and_token(params[:user_id], params[:token])
render :template => 'passwords/edit'
end
def update
- @user = User.find_by_id_and_token(params[:user_id], params[:token])
+ @user = ::User.find_by_id_and_token(params[:user_id], params[:token])
if @user.update_password(params[:user][:password],
params[:user][:password_confirmation])
@@ -49,7 +49,7 @@ def forbid_missing_token
end
def forbid_non_existent_user
- unless User.find_by_id_and_token(params[:user_id], params[:token])
+ unless ::User.find_by_id_and_token(params[:user_id], params[:token])
raise ActionController::Forbidden, "non-existent user"
end
end
View
2 app/controllers/clearance/sessions_controller.rb
@@ -9,7 +9,7 @@ def new
end
def create
- @user = User.authenticate(params[:session][:email],
+ @user = ::User.authenticate(params[:session][:email],
params[:session][:password])
if @user.nil?
flash.now[:notice] = "Bad email or password."
View
4 app/controllers/clearance/users_controller.rb
@@ -5,12 +5,12 @@ class Clearance::UsersController < ApplicationController
filter_parameter_logging :password
def new
- @user = User.new(params[:user])
+ @user = ::User.new(params[:user])
render :template => 'users/new'
end
def create
- @user = User.new params[:user]
+ @user = ::User.new params[:user]
if @user.save
ClearanceMailer.deliver_confirmation @user
flash[:notice] = "You will receive an email within the next few minutes. " <<

0 comments on commit 38bafd1

Please sign in to comment.
Something went wrong with that request. Please try again.