Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. def create
  2. logout_keeping_session!
  3. @user = User.new(params[:user])
  4. success = @user && @user.save
  5. if success && @user.errors.empty?
  6. # Protects against session fixation attacks, causes request forgery
  7. # protection if visitor resubmits an earlier form using back
  8. # button. Uncomment if you understand the tradeoffs.
  9. # reset session
  10. self.current_user = @user # !! now logged in
  11. redirect_back_or_default('/')
  12. flash[:notice] = "Thanks for signing up! We're sending you an email with your activation code."
  13. else
  14. flash[:error] = "We couldn't set up that account, sorry. Please try again, or contact an admin (link is above)."
  15. render :action => 'new'
  16. end
  17. end
Add Comment
Please, Sign In to add comment