Class: Contour::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
app/controllers/contour/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/contour/registrations_controller.rb', line 4

def create
  if user_signed_in?
    params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19]
    @user = User.new(params[:user])
    if @user.save
      [:pp_committee, :pp_committee_secretary, :steering_committee, :steering_committee_secretary, :system_admin, :status].each do |attribute|
        @user.update_attribute attribute, params[:user][attribute]
      end
      redirect_to(@user, :notice => 'User was successfully created.')
    else
      render :action => "/users/new"
    end
  else
    super
    session[:omniauth] = nil unless @user.new_record?
  end
end