Sha256: 523a25bd413c6360527ce612a75a2a4ca3f59083e3b3707e752dcd63394c6779

Contents?: true

Size: 696 Bytes

Versions: 4

Compression:

Stored size: 696 Bytes

Contents

class <%= session_plural_class_name %>Controller < ApplicationController
  skip_before_filter :login_required
  
  layout 'login'
  	
  def new
    @<%= session_singular_name %> = <%= session_class_name %>.new
  end
  
  def create
    @<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
    if @<%= session_singular_name %>.save
      flash[:notice] = "Bem-vindo!"
      redirect_to admin_home_url
    else
      flash.now[:error] = "Usuário/E-mail ou senha inválidos."	
      render :action => 'new'
    end
  end
  
  def destroy
    current_<%= session_singular_name %>.destroy
    redirect_to login_url
  end
end  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flexi_generators-0.2.3 lib/generators/flexi_auth/templates/sessions_controller.rb
flexi_generators-0.2.2 lib/generators/flexi_auth/templates/sessions_controller.rb
flexi_generators-0.2.1 lib/generators/flexi_auth/templates/sessions_controller.rb
flexi_generators-0.2.0 lib/generators/flexi_auth/templates/sessions_controller.rb