Class: Wechat::AppsController
- Inherits:
-
BaseController
- Object
- BaseController
- BaseController
- Wechat::AppsController
- Defined in:
- app/controllers/wechat/apps_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
45 46 |
# File 'app/controllers/wechat/apps_controller.rb', line 45 def create end |
#login ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/wechat/apps_controller.rb', line 26 def login @oauth_user = @app.generate_wechat_user(params[:code]) if @oauth_user.account.nil? && current_account @oauth_user.account = current_account end @oauth_user.save if @oauth_user.user login_by_oauth_user(@oauth_user) Com::SessionChannel.broadcast_to(params[:state], auth_token: .token) else = {} .merge! params.except(:controller, :action, :id, :business, :namespace, :code, :state).permit! .merge! host: URI(session[:return_to]).host if session[:return_to] redirect_to url_for(controller: 'auth/sign', action: 'sign', uid: @oauth_user.uid, **) end end |
#show ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/wechat/apps_controller.rb', line 6 def show @oauth_user = @app.generate_wechat_user(params[:code]) if @oauth_user.account.nil? && current_account @oauth_user.account = current_account end @oauth_user.save if @oauth_user.user login_by_oauth_user(@oauth_user) redirect_to session[:return_to] || RailsAuth.config.default_return_path session.delete :return_to else = {} .merge! params.except(:controller, :action, :id, :business, :namespace, :code, :state).permit! .merge! host: URI(session[:return_to]).host if session[:return_to] redirect_to url_for(controller: 'auth/sign', action: 'sign', uid: @oauth_user.uid, **) end end |