Class: User::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
DeviseExtender, DomainController
Defined in:
app/controllers/user/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_sign_up_path_for(resource) ⇒ Object



11
12
13
14
15
# File 'app/controllers/user/registrations_controller.rb', line 11

def (resource)
  path = session[:return_to] || "/"
  session[:return_to] = nil
  return path.to_s
end

#createObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/user/registrations_controller.rb', line 17

def create
  self.kit_template = "user/register" 
  build_resource
  @attributes = UserAttribute.sys(_sid).where(:show_on_signup=>1).all

  if resource.save
    user = resource
    @attributes.each do |attr|
      if params[attr.code_name]
        uav = UserAttributeValue.new
        uav.user_attribute_id = attr.id
        uav.user = user
        uav.value = params[attr.code_name]
        uav.updated_by = current_user
        uav.system_id = _sid
        uav.save
      end
    end if @attributes
    if params[:groups]
      params[:groups].split(',').each do |gg|
        group = Group.find_sys_id(_sid, gg)
        user.groups << group
      end
    end
    resource.update_index
    if resource.active_for_authentication?
      set_flash_message :notice, :signed_up if is_navigational_format?
      (resource_name, resource)
      redirect_to (resource)
    else
      set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
      expire_session_data_after_sign_in!
      respond_with resource, :location => (resource)
    end
  else
    clean_up_passwords resource
    respond_with resource
  end
end

#editObject



80
81
82
83
84
# File 'app/controllers/user/registrations_controller.rb', line 80

def edit 
  @page_title = "Edit Account"
  self.kit_template = "user/edit"
  super
end

#newObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/user/registrations_controller.rb', line 57

def new
  @page_title = "Sign Up"
  self.kit_template = "user/register"

  session[:captcha_okay] = true
  if params[:return_to]
    session[:return_to] = params[:return_to]
  elsif url = Preference.get_cached(_sid, "url_after_sign_up")
    session[:return_to] = url
  else
    session[:return_to] ||= request.referer
  end

  @attributes = UserAttribute.sys(_sid).where(:show_on_signup=>1).all
  super
end

#updateObject



74
75
76
77
78
# File 'app/controllers/user/registrations_controller.rb', line 74

def update
  @page_title = "Edit Account"
  self.kit_template = "user/edit"
  super
end