Module: Conjoin::Auth
- Includes:
- Devise::TestHelpers
- Defined in:
- lib/conjoin/auth.rb
Defined Under Namespace
Classes: Routes
Class Attribute Summary collapse
-
.app ⇒ Object
Returns the value of attribute app.
Class Method Summary collapse
Instance Method Summary collapse
- #current_user ⇒ Object
- #logged_in? ⇒ Boolean
- #login_path ⇒ Object
- #logout_path ⇒ Object
- #sign_in(*args) ⇒ Object
Class Attribute Details
.app ⇒ Object
Returns the value of attribute app.
10 11 12 |
# File 'lib/conjoin/auth.rb', line 10 def app @app end |
Class Method Details
Instance Method Details
#current_user ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/conjoin/auth.rb', line 31 def current_user if not Conjoin.env.mounted? authenticated(Subrolink::Models::User) else req.env['warden'].authenticate(scope: :user) end end |
#logged_in? ⇒ Boolean
39 40 41 |
# File 'lib/conjoin/auth.rb', line 39 def logged_in? current_user ? true : false end |
#login_path ⇒ Object
23 24 25 |
# File 'lib/conjoin/auth.rb', line 23 def login_path req.env['REQUEST_URI'][/login/] ? true : false end |
#logout_path ⇒ Object
27 28 29 |
# File 'lib/conjoin/auth.rb', line 27 def logout_path req.env['REQUEST_URI'][/logout/] ? true : false end |
#sign_in(*args) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/conjoin/auth.rb', line 43 def sign_in *args if args.length > 1 user, scope = args else scope = :user user = args.first end if Auth.app.mounted? @request = req super scope, user else session.clear session['VendorWizard::User'] = user.id end end |