私有项目邮件邀请权限认证
This commit is contained in:
parent
d6aeb5b0e7
commit
697f891546
|
@ -243,26 +243,7 @@ class ProjectsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description 项目动态展示方法,删除了不必要的代码
|
||||
def show
|
||||
# params[:login]为邮箱邀请用户加入,主要功能:
|
||||
# 1、自动注册
|
||||
# 2、加入项目、创建角色
|
||||
# 3、用户得分
|
||||
if params[:mail]
|
||||
user = User.find(params[:user_id])
|
||||
user.activate!
|
||||
Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id])
|
||||
UserGrade.create(:user_id => params[:user_id], :project_id => params[:id])
|
||||
token = Token.get_token_from_user(user, 'autologin')
|
||||
#user = User.try_to_autologin(token.value)
|
||||
if user
|
||||
start_user_session(user)
|
||||
user.save
|
||||
redirect_to project_member_path(params[:id])
|
||||
return
|
||||
# account_ project_member_path(params[:id])
|
||||
flash[:notice] = l(:label_mail_invite_success)
|
||||
end
|
||||
end
|
||||
|
||||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
end
|
||||
|
@ -411,6 +392,26 @@ class ProjectsController < ApplicationController
|
|||
# by young
|
||||
# include CoursesHelper
|
||||
def member
|
||||
# params[:login]为邮箱邀请用户加入,主要功能:
|
||||
# 1、自动注册
|
||||
# 2、加入项目、创建角色
|
||||
# 3、用户得分
|
||||
if params[:mail]
|
||||
user = User.find(params[:user_id])
|
||||
user.activate!
|
||||
Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id])
|
||||
UserGrade.create(:user_id => params[:user_id], :project_id => params[:id])
|
||||
token = Token.get_token_from_user(user, 'autologin')
|
||||
#user = User.try_to_autologin(token.value)
|
||||
if user
|
||||
start_user_session(user)
|
||||
user.save
|
||||
redirect_to project_member_path(params[:id])
|
||||
return
|
||||
# account_ project_member_path(params[:id])
|
||||
flash[:notice] = l(:label_mail_invite_success)
|
||||
end
|
||||
end
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
@render_file = 'project_member_list'
|
||||
# 判断是否课程
|
||||
|
|
|
@ -61,7 +61,7 @@ class Mailer < ActionMailer::Base
|
|||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user_id => user.id, :mail => true)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true)
|
||||
mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
|
@ -72,8 +72,9 @@ class Mailer < ActionMailer::Base
|
|||
@invitor_name = "#{invitor.name}"
|
||||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@project = project
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue