Class: ShopifyApp::SessionsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ShopifyApp::SessionsController
show all
- Includes:
- LoginProtection
- Defined in:
- app/controllers/shopify_app/sessions_controller.rb
Constant Summary
LoginProtection::ACCESS_TOKEN_REQUIRED_HEADER
Instance Method Summary
collapse
#activate_shopify_session, #current_shopify_session, #jwt_expire_at, #login_again_if_different_user_or_shop, #shop_session, #shop_session_by_jwt, #signal_access_token_required, #user_session, #user_session_by_cookie, #user_session_by_jwt
Instance Method Details
#create ⇒ Object
16
17
18
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 16
def create
authenticate
end
|
#destroy ⇒ Object
54
55
56
57
58
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 54
def destroy
reset_session
flash[:notice] = I18n.t('.logged_out')
redirect_to(login_url_with_optional_shop)
end
|
#enable_cookies ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 20
def enable_cookies
return unless validate_shop_presence
render(:enable_cookies, layout: false, locals: {
does_not_have_storage_access_url: top_level_interaction_path(
shop: sanitized_shop_name,
host: host,
return_to: params[:return_to]
),
has_storage_access_url: login_url_with_optional_shop(top_level: true),
app_target_url: granted_storage_access_path(
shop: sanitized_shop_name,
host: host,
return_to: params[:return_to]
),
current_shopify_domain: current_shopify_domain,
})
end
|
#granted_storage_access ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 44
def granted_storage_access
return unless validate_shop_presence
session['shopify.granted_storage_access'] = true
copy_return_to_param_to_session
redirect_to(return_address_with_params({ shop: @shop }))
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 12
def new
authenticate if sanitized_shop_name.present?
end
|
#top_level_interaction ⇒ Object
39
40
41
42
|
# File 'app/controllers/shopify_app/sessions_controller.rb', line 39
def top_level_interaction
@url = login_url_with_optional_shop(top_level: true)
validate_shop_presence
end
|