Module: CamaleonCms::SessionRuntimeConcern
- Extended by:
- ActiveSupport::Concern
- Includes:
- EmailHelper, SessionCaptchaRuntimeConcern, SessionHelper
- Included in:
- CamaleonController
- Defined in:
- app/controllers/concerns/camaleon_cms/session_runtime_concern.rb
Overview
Wires the session/auth and email helpers into the runtime controller stack. Behaviour lives in the helper modules (single source of truth) so view and controller contexts cannot drift apart.
Constant Summary
Constants included from CaptchaHelper
CaptchaHelper::CAMA_ATTACK_WINDOW
Constants included from CaptchaImageGeneration
CaptchaImageGeneration::CAPTCHA_DEFAULT_LENGTH, CaptchaImageGeneration::CAPTCHA_MAX_LENGTH, CaptchaImageGeneration::CAPTCHA_MIN_LENGTH
Instance Method Summary collapse
-
#auth_session_error ⇒ Object
Redirect to login when the session has expired.
- #cama_register_user(user_data, meta) ⇒ Object
-
#login_user_with_password(username, password) ⇒ Object
Back-compat: expose the affected user record as the
@usercontroller ivar for legacy templates/plugins.
Methods included from CaptchaHelper
#cama_captcha_attack_ip_count, #cama_captcha_attack_ip_key, #cama_captcha_increment_attack, #cama_captcha_reset_attack, #cama_captcha_tag, #cama_captcha_tags_if_under_attack, #cama_captcha_total_attacks, #cama_captcha_under_attack?, #cama_captcha_verified?, #captcha_verify_if_under_attack
Methods included from CaptchaImageGeneration
Methods included from EmailHelper
#cama_send_email, #cama_send_mail_to_admin, #send_email, #send_password_reset_email, #send_user_confirm_email
Methods included from HooksHelper
#hook_run, #hook_skip, #hooks_run
Methods included from PluginsHelper
#current_plugin, #plugin_asset_path, #plugin_asset_url, #plugin_destroy, #plugin_install, #plugin_layout, #plugin_load_helpers, #plugin_uninstall, #plugin_upgrade, #plugin_view, #plugins_initialize, #self_plugin_key
Methods included from SiteHelper
#cama_current_site_host_port, #cama_get_list_layouts_files, #cama_get_list_template_files, #cama_is_test_request?, #current_locale, #current_site, #current_theme, #site_after_install, #site_install_theme, #site_uninstall_theme
Methods included from SessionHelper
#cama_authenticate, #cama_current_role, #cama_current_user, #cama_get_session_id, #cama_impersonation_parent_user, #cama_logout_user, #cama_on_heroku?, #cama_sign_in?, #cookie_auth_token_complete?, #cookie_split_auth_token, #login_user, #session_back_to_parent, #session_switch_user, #user_auth_token_from_cookie
Instance Method Details
#auth_session_error ⇒ Object
Redirect to login when the session has expired. Lives here because it is a controller-only redirect concern (not a view helper).
36 37 38 |
# File 'app/controllers/concerns/camaleon_cms/session_runtime_concern.rb', line 36 def auth_session_error redirect_to cama_root_path end |
#cama_register_user(user_data, meta) ⇒ Object
28 29 30 31 32 |
# File 'app/controllers/concerns/camaleon_cms/session_runtime_concern.rb', line 28 def cama_register_user(user_data, ) result = super @user = result[:user] if result.is_a?(Hash) && result.key?(:user) result end |
#login_user_with_password(username, password) ⇒ Object
Back-compat: expose the affected user record as the @user controller ivar
for legacy templates/plugins. The helper methods themselves stay ivar-free;
these controller-concern overrides own the instance-variable bridging so the
shared view helpers never pollute the view context.
22 23 24 25 26 |
# File 'app/controllers/concerns/camaleon_cms/session_runtime_concern.rb', line 22 def login_user_with_password(username, password) result = super @user = current_site.users.find_by(username: username) result end |