diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2b58f1265..96807d2dc 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -247,10 +247,9 @@ class ProjectsController < ApplicationController # 1、自动注册 # 2、加入项目、创建角色 # 3、用户得分 - if params[:login] - # 自动激活用户 - user.status = 1 - user.save + if params[:email] + user = User.find_by_mail(params[:email].to_s) + Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id) end if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return diff --git a/app/models/mailer.rb b/app/models/mailer.rb index d35374fcf..e2ccb2230 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -71,14 +71,14 @@ class Mailer < ActionMailer::Base # 邀请已注册的用户加入项目 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) - Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id) - @invitor_name = "#{invitor.name}" - @project_name = "#{project.name}" - @user = user - @token = Token.get_token_from_user(user, 'autologin') - @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value) - mail :to => email, :invitor_name => "#{@invitor_name}", :project_name => "#{@project_name}" + @invitor_name = "#{invitor.name}" + @project_name = "#{project.name}" + @user = user + @token = Token.get_token_from_user(user, 'autologin') + @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :email => email, :token => @token.value) + mail :to => email, :subject => @subject end # author: alan