Class: SimplyAuth::RegistrationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/simply_auth/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_registration(user) ⇒ Object



12
# File 'app/controllers/simply_auth/registrations_controller.rb', line 12

def after_registration(user); end

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/simply_auth/registrations_controller.rb', line 14

def create
  @user = SimplyAuth::User.new(user_params)
  if @user.save
    after_registration(@user)

    @session = SimplyAuth::Session.new(email: user_params[:email], password: user_params[:password])
    @session.save
    session[:simply_auth_session_id] = @session.id
    redirect_to "/"
  else
    render :new
  end
end

#indexObject



7
8
9
10
# File 'app/controllers/simply_auth/registrations_controller.rb', line 7

def index
  #handle refresh on validation error
  redirect_to new_registration_path
end

#newObject



3
4
5
# File 'app/controllers/simply_auth/registrations_controller.rb', line 3

def new
  @user = SimplyAuth::User.new
end