修改邮件通知提醒(邀请:未激活

点击链接:激活并加入项目)
This commit is contained in:
huang 2015-05-29 14:36:44 +08:00
parent cae882b3d6
commit d9ae9c8061
3 changed files with 17 additions and 4 deletions

View File

@ -248,8 +248,20 @@ class ProjectsController < ApplicationController
# 2、加入项目、创建角色 # 2、加入项目、创建角色
# 3、用户得分 # 3、用户得分
if params[:mail] if params[:mail]
Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id]) user = User.find(params[:user_id])
UserGrade.create(:user_id =>params[:user], :project_id => params[: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 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

@ -60,8 +60,8 @@ class Mailer < ActionMailer::Base
user = us.register_auto(login, @email, @password) user = us.register_auto(login, @email, @password)
User.current = user unless User.current.nil? User.current = user unless User.current.nil?
@user = user @user = user
@token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user_id => user.id, :mail => true)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end

View File

@ -342,6 +342,7 @@ zh:
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_user_role_null: 用户和角色不能留空! label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目 label_invite_project: 邀请您加入项目
label_mail_invite_success: 您已成功加入项目!
label_invite_success: 邀请成功 label_invite_success: 邀请成功
label_invite_members: 邀请用户 label_invite_members: 邀请用户
# #