Sha256: 1a6855ccf2ef002fb051d5dd0c5b547e3b752eaef1561961b3cfaf88d8c0a0e1

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

#--
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#                    Version 2, December 2004
#
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
#  0. You just DO WHAT THE FUCK YOU WANT TO.
#++

class ${ClassName}
  helpers do
    def current_user
      guest = Guest.new
      return guest unless cookie_exists? 'sessid'
      User.first(:session => get_cookie('sessid')) || guest
    end

    def logged_in?
      current_user.is_a? User
    end
      alias_method :logged?, :logged_in?

    def set_login(session)
      set_cookie 'sessid', session
    end
      alias_method :set_login!, :set_login

    def delete_login
      delete_cookie 'sessid'
    end
      alias_method :delete_login!, :delete_login
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gennaro-0.3.2.3 templates/authentication/app/helpers/user.rb
gennaro-0.3.2.2 templates/authentication/app/helpers/user.rb
gennaro-0.3.2.1 templates/authentication/app/helpers/user.rb
gennaro-0.3.2 templates/authentication/app/helpers/user.rb
gennaro-0.3.1.3 templates/authentication/app/helpers/user.rb
gennaro-0.3.1.2 templates/authentication/app/helpers/user.rb
gennaro-0.3.1.1 templates/authentication/app/helpers/user.rb
gennaro-0.3.1 templates/authentication/app/helpers/user.rb
gennaro-0.3 templates/authentication/app/helpers/user.rb