Class: Contour::SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- Contour::SessionsController
- Defined in:
- app/controllers/contour/sessions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Overwrite Devise authentication to check if the user is typing another credential into the default box if so, find alternative login methods for that user and forward the user to those login screens.
- #new ⇒ Object
Instance Method Details
#create ⇒ Object
Overwrite Devise authentication to check if the user is typing another credential into the default box if so, find alternative login methods for that user and forward the user to those login screens
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/contour/sessions_controller.rb', line 24 def create # resource = warden.authenticate!(auth_options) resource = warden.authenticate() if resource (:notice, :signed_in) if sign_in(resource_name, resource) respond_to do |format| format.html { respond_with resource, location: after_sign_in_path_for(resource) } format.json { render json: { success: true, user: resource.as_json( only: [:id, :email, :first_name, :last_name, :authentication_token ] ) } } end else resource = resource_name.to_s.titleize.constantize.find_by_email(params[resource_name][:email]) if resource and resource.respond_to?('authentications') and providers = resource.authentications.pluck(:provider).uniq and providers.size > 0 redirect_to request.script_name + '/auth/' + providers.first elsif providers = Authentication.where(uid: params[resource_name][:email]).pluck(:provider).uniq and providers.size > 0 redirect_to request.script_name + '/auth/' + providers.first else resource = warden.authenticate!() end end end |
#new ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/contour/sessions_controller.rb', line 6 def new @news_feed = '' unless Contour.news_feed.blank? begin open(Contour.news_feed, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http| response = http.read @news_feed = RSS::Parser.parse(response, false) end rescue => e logger.info "\n\nRSS Feed #{Contour.news_feed}\nRSS Feed Error: #{e}\n\n" end end super end |