Class: Aviate::ConfigurationController
- Inherits:
-
EngineController
- Object
- EngineController
- Aviate::ConfigurationController
- Defined in:
- app/controllers/aviate/configuration_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
7 8 9 |
# File 'app/controllers/aviate/configuration_controller.rb', line 7 def index @available = Killbill::Aviate::AviateClient.aviate_plugin_available?().first end |
#session_create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/aviate/configuration_controller.rb', line 11 def session_create = email = params[:aviate_email] password = params[:aviate_password] response = Killbill::Aviate::AviateClient.authenticate(email, password, ) if response.is_a?(Hash) && response['token'] # Store JWT in encrypted cookie [:jwt_token] = { value: response['token'], httponly: true, secure: request.ssl?, same_site: :strict, expires: 1.hour.from_now } flash[:notice] = t('aviate.configuration.authentication_success') else flash[:error] = t('aviate.configuration.authentication_failed') end redirect_to aviate_root_path end |
#session_destroy ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/aviate/configuration_controller.rb', line 34 def session_destroy # Delete JWT cookie .delete(:jwt_token) flash[:notice] = t('aviate.configuration.logout_success') redirect_to aviate_root_path end |