Created
December 23, 2009 01:44
-
-
Save adrianpike/262249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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