app/controllers/nyauth/sessions_controller.rb in nyauth-0.0.2 vs app/controllers/nyauth/sessions_controller.rb in nyauth-0.0.3
- old
+ new
@@ -1,21 +1,23 @@
module Nyauth
- class SessionsController < Nyauth::BaseController
+ class SessionsController < ApplicationController
+ include Nyauth::ApplicationConcern
+ include Nyauth::ClientConcern
allow_everyone only: [:new, :create]
respond_to :html, :json
before_action :set_session_service
def new
end
def create
- sign_in(@session_service.client) if @session_service.save
- respond_with @session_service, location: root_path
+ sign_in(@session_service.client) if @session_service.save(as: client_name)
+ respond_with @session_service, location: Nyauth.configuration.redirect_path_after_sign_in || main_app.root_path
end
def destroy
sign_out
- respond_with @session_service, location: root_path
+ respond_with @session_service, location: Nyauth.configuration.redirect_path_after_sign_out || new_session_path
end
private
def set_session_service