ref: master
plugins/driven_signup/controllers/public/driven_signup_plugin/account_controller.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
class DrivenSignupPlugin::AccountController < PublicController def signup return render_access_denied unless Rails.env.development? or request.post? return render_access_denied unless self.environment.driven_signup_auths.where(token: params[:token]).first session[:driven_signup] = true session[:base_organization] = params[:base_organization] session[:find_suborganization] = params[:find_suborganization] session[:suborganization_members_limit] = params[:suborganization_members_limit] session[:user_template] = params[:user_template] user_attributes = [:login, :email] user_params = params[:signup].slice *user_attributes profile_params = params[:signup].except *user_attributes if current_user and user_params[:email].squish == current_user.email current_user.driven_signup_complete redirect_to session.delete(:after_signup_redirect_to) else self.current_user = nil redirect_to controller: :account, action: :signup, user: user_params, profile_data: profile_params end end protected # inherit routes from core skipping use_relative_controller! def url_for options options[:controller] = "/#{options[:controller]}" if options.is_a? Hash and options[:controller] and not options[:controller].to_s.starts_with? '/' super options end helper_method :url_for end |