Skip to content

Instantly share code, notes, and snippets.

@adrianpike
Created December 23, 2009 01:44
Show Gist options
  • Save adrianpike/262249 to your computer and use it in GitHub Desktop.
Save adrianpike/262249 to your computer and use it in GitHub Desktop.
# CONTROLLER
if $INVITE_ONLY and (params[:invite_key] != @user.invite_key) then
flash.now[:error] = t 'account.invalid_invite'
render :action => :new
else
if @user.save
flash[:notice] = t 'account.created'
redirect_to account_path
else
render :action => :new
end
end
# MODEL
def invite_key
Digest::SHA1.hexdigest(self.email.downcase + 'cool secret junk, put lots of random chars here')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment