Class: Users::SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Defined in:
app/controllers/virgo/users/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/virgo/users/sessions_controller.rb', line 12

def create
  self.resource = warden.authenticate!(auth_options)
  (resource_name, resource)
  flash[:notice] = "You have signed in successfully"

  if params[:next].present?
    redirect_to params[:next]
  else
    if resource.admin?
      redirect_to virgo.admin_posts_path
    else
      redirect_to virgo.root_path
    end
  end
end

#newObject

GET /resource/sign_in


6
7
8
9
10
# File 'app/controllers/virgo/users/sessions_controller.rb', line 6

def new
  self.resource = resource_class.new()
  clean_up_passwords(resource)
  respond_with(resource, serialize_options(resource))
end

#sign_in_paramsObject


28
29
30
# File 'app/controllers/virgo/users/sessions_controller.rb', line 28

def 
  params[:user].present? ? params.require(:user).permit(:username, :email, :first_name, :last_name, :password) : {}
end