Only users with verified emails are allowed to create new jobs
This commit is contained in:
@@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
before_action :set_current_request_details
|
||||
before_action :authenticate_user!
|
||||
before_action :verified_user!
|
||||
|
||||
verify_authorized
|
||||
|
||||
@@ -29,6 +30,15 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def verified_user!
|
||||
if user_signed_in?
|
||||
unless current_user.verified?
|
||||
flash[:notice] = "Please verify your email!"
|
||||
redirect_to profile_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_current_request_details
|
||||
Current.user_agent = request.user_agent
|
||||
Current.ip_address = request.ip
|
||||
|
||||
Reference in New Issue
Block a user