Class: Mori::RegistrationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/mori/registrations_controller.rb

Overview

Mori::RegistrationsController is responsible for signing up new users

Instance Method Summary collapse

Methods inherited from BaseController

#mori_config, #set_token

Instance Method Details

#confirmationObject



23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/mori/registrations_controller.rb', line 23

def confirmation
  user = @config.user_model.find_by_confirmation_token(@token)
  if confirmation_conditions(user)
    user.confirm_email
    flash[:notice] = I18n.t('flashes.email_confirmed')
    redirect_to @config.dashboard_path
  else
    flash[:notice] = I18n.t('flashes.invalid_confirmation_token')
    redirect_to root_path
  end
end

#createObject



12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/mori/registrations_controller.rb', line 12

def create
  @user = user_from_params
  if @user.save
    warden.authenticate!
    redirect_to @config.
  else
    flash[:notice] = @user.errors.map { |key, val| "#{key} #{val}" }.join(' and ').humanize
    render :template => 'registrations/new'
  end
end

#newObject



3
4
5
6
7
8
9
10
# File 'app/controllers/mori/registrations_controller.rb', line 3

def new
  if current_user
    redirect_to @config.dashboard_path
  else
    @user = @config.user_model.new
    render :template => 'registrations/new'
  end
end