Sha256: c46e7997a5d4a3cdd30b61489e6f8437b3525cfb418b7d641db18a4beb5a61c9
Contents?: true
Size: 918 Bytes
Versions: 1
Compression:
Stored size: 918 Bytes
Contents
class Authenticate::SessionsController < ApplicationController before_action :redirect_signed_in_users, only: [:new] skip_before_action :require_authentication, only: [:create, :new, :destroy], raise: false def new render template: 'sessions/new' end def create @user = authenticate(params) login(@user) do |status| if status.success? redirect_back_or url_after_create else flash.now.notice = status.message render template: 'sessions/new', status: :unauthorized end end end def destroy logout redirect_to url_after_destroy end private def redirect_signed_in_users if authenticated? redirect_to url_for_signed_in_users end end def url_after_create Authenticate.configuration.redirect_url end def url_after_destroy sign_in_url end def url_for_signed_in_users url_after_create end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authenticate-0.2.0 | app/controllers/authenticate/sessions_controller.rb |