Skip to content

Instantly share code, notes, and snippets.

@sebastiangeiger
Created April 15, 2013 15:50
Show Gist options
  • Select an option

  • Save sebastiangeiger/5389098 to your computer and use it in GitHub Desktop.

Select an option

Save sebastiangeiger/5389098 to your computer and use it in GitHub Desktop.
Devise strategy used when an admin has to verify users before they are granted access to a site.
# encoding: UTF-8
class CheckVerifiedStrategy < ::Devise::Strategies::Base
def valid?
params[:user] and params[:user][:email]
end
def authenticate!
user = User.where(email: params[:user][:email]).first
if user and not user.verified?
fail!(I18n.t('profile.requested'))
else
pass
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment