Created
March 25, 2009 09:01
-
-
Save mchung/85380 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
class UsersController < ApplicationController | |
include Clearance::App::Controllers::UsersController | |
# Override and add in a check for invitation code | |
def create | |
@user = User.new params[:user] | |
invite_code = params[:invite_code] | |
@invite = Invite.find_redeemable(invite_code) | |
if invite_code && @invite | |
if @user.save | |
@invite.redeemed! | |
ClearanceMailer.deliver_confirmation @user | |
flash[:notice] = "You will receive an email within the next few minutes. " << | |
"It contains instructions for confirming your account." | |
redirect_to url_after_create | |
else | |
render :action => "new" | |
end | |
else | |
flash.now[:notice] = "Sorry, that code is not redeemable" | |
render :action => "new" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment