Skip to content

Instantly share code, notes, and snippets.

@jjulian
Created April 15, 2010 18:03
Show Gist options
  • Save jjulian/367418 to your computer and use it in GitHub Desktop.
Save jjulian/367418 to your computer and use it in GitHub Desktop.
def handle_approved(handle)
allowed = YAML::load_file('/var/www/allowed.yml')
allowed.include?(handle.downcase)
end
# in the action, after the twitter handle is pulled from oauth
if !handle_approved(handle)
reset_session
flash[:notice] = 'Sorry, your username is not allowed'
logger.error "denied access for #{handle}"
redirect_to root_url and return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment