修改邮件邀请--邮件名

修改成用户点击同意按钮后才能加入项目
This commit is contained in:
huang 2015-04-30 16:30:02 +08:00
parent 431c6888a7
commit 76b4ae24da
2 changed files with 10 additions and 11 deletions

View File

@ -247,10 +247,9 @@ class ProjectsController < ApplicationController
# 1、自动注册 # 1、自动注册
# 2、加入项目、创建角色 # 2、加入项目、创建角色
# 3、用户得分 # 3、用户得分
if params[:login] if params[:email]
# 自动激活用户 user = User.find_by_mail(params[:email].to_s)
user.status = 1 Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
user.save
end end
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return

View File

@ -71,14 +71,14 @@ class Mailer < ActionMailer::Base
# 邀请已注册的用户加入项目 # 邀请已注册的用户加入项目
def request_member_to_project(email, project, invitor) def request_member_to_project(email, project, invitor)
@subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
user = User.find_by_mail(email.to_s) user = User.find_by_mail(email.to_s)
Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id) @invitor_name = "#{invitor.name}"
@invitor_name = "#{invitor.name}" @project_name = "#{project.name}"
@project_name = "#{project.name}" @user = user
@user = user @token = Token.get_token_from_user(user, 'autologin')
@token = Token.get_token_from_user(user, 'autologin') @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :email => email, :token => @token.value)
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value) mail :to => email, :subject => @subject
mail :to => email, :invitor_name => "#{@invitor_name}", :project_name => "#{@project_name}"
end end
# author: alan # author: alan