Class: Wechat::AppsController

Inherits:
BaseController show all
Defined in:
app/controllers/wechat/apps_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



45
46
# File 'app/controllers/wechat/apps_controller.rb', line 45

def create
end

#loginObject



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 
  @oauth_user = @app.generate_wechat_user(params[:code])
  if @oauth_user..nil? && 
    @oauth_user. = 
  end
  @oauth_user.save

  if @oauth_user.user
    (@oauth_user)
    Com::SessionChannel.broadcast_to(params[:state], auth_token: current_authorized_token.token)
  else
    url_options = {}
    url_options.merge! params.except(:controller, :action, :id, :business, :namespace, :code, :state).permit!
    url_options.merge! host: URI(session[:return_to]).host if session[:return_to]

    redirect_to url_for(controller: 'auth/sign', action: 'sign', uid: @oauth_user.uid, **url_options)
  end
end

#showObject



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..nil? && 
    @oauth_user. = 
  end
  @oauth_user.save

  if @oauth_user.user
    (@oauth_user)
    redirect_to session[:return_to] || RailsAuth.config.default_return_path
    session.delete :return_to
  else
    url_options = {}
    url_options.merge! params.except(:controller, :action, :id, :business, :namespace, :code, :state).permit!
    url_options.merge! host: URI(session[:return_to]).host if session[:return_to]

    redirect_to url_for(controller: 'auth/sign', action: 'sign', uid: @oauth_user.uid, **url_options)
  end
end