加入组织

This commit is contained in:
guange 2016-05-05 14:52:10 +08:00
parent 17282083a6
commit 72f5f5b795
1 changed files with 9 additions and 4 deletions

View File

@ -22,13 +22,17 @@ class SsosController < ApplicationController
logger.debug @options
## 认证
login(@options)
sso = login(@options)
logger.debug "login over"
## 加入组织
@organization = Organization.find(82)
unless @organization.org_members.exists?(user_id: sso.user_id)
member = OrgMember.new(:user_id => sso.user_id)
@organization.org_members << member
end
## 选择性跳转
redirect_to Organization.find(82)
redirect_to @organization
rescue => e
logger.error e
if e.message == "exist user"
@ -61,6 +65,7 @@ class SsosController < ApplicationController
def login(opt)
sso = Sso.sync_user(opt)
start_user_session(sso.user)
sso
end
end