邮件:邀请新用户的时候过滤掉邮箱和已注册用户名重叠的问题
This commit is contained in:
parent
4a7d3c9072
commit
295921c89d
|
@ -359,11 +359,16 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
# 两种情况:1、系统外用户;2、系统内用户 (通过邮件判定)
|
# 两种情况:1、系统外用户;2、系统内用户 (通过邮件判定)
|
||||||
def send_mail_to_member
|
def send_mail_to_member
|
||||||
if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil?
|
# 该邮箱未注册过
|
||||||
|
if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil? && User.where("login =?", params[:mail]).first.nil?
|
||||||
email = params[:mail]
|
email = params[:mail]
|
||||||
Mailer.run.send_invite_in_project(email, @project, User.current)
|
Mailer.run.send_invite_in_project(email, @project, User.current)
|
||||||
@is_zhuce = false
|
@is_zhuce = false
|
||||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||||
|
# 用户名唯一,如果该邮箱被用户作为用户名使用则跳出
|
||||||
|
elsif !User.where("login =?", params[:mail]).first.nil?
|
||||||
|
flash[:error] = l(:notice_email_login_used)
|
||||||
|
# 已经是系统注册用户
|
||||||
elsif !User.find_by_mail(params[:mail].to_s).nil?
|
elsif !User.find_by_mail(params[:mail].to_s).nil?
|
||||||
user = User.find_by_mail(params[:mail].to_s)
|
user = User.find_by_mail(params[:mail].to_s)
|
||||||
if !user.member_of?(@project)
|
if !user.member_of?(@project)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Mailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# author: alan
|
# author: alan
|
||||||
# 发送邀请未注册用户加入项目邮件
|
# 邀请未注册用户加入项目
|
||||||
# 功能: 在加入项目的同时自动注册用户
|
# 功能: 在加入项目的同时自动注册用户
|
||||||
def send_invite_in_project(email, project, invitor)
|
def send_invite_in_project(email, project, invitor)
|
||||||
@email = email
|
@email = email
|
||||||
|
|
|
@ -52,6 +52,7 @@ zh:
|
||||||
notice_not_authorized_archived_project: 要访问的项目已经归档。
|
notice_not_authorized_archived_project: 要访问的项目已经归档。
|
||||||
notice_not_authorized_message: 您访问的消息不存在!
|
notice_not_authorized_message: 您访问的消息不存在!
|
||||||
notice_email_sent: "邮件已发送至 %{value}"
|
notice_email_sent: "邮件已发送至 %{value}"
|
||||||
|
notice_email_login_used: 该邮箱地址已经有人作为登录名使用!
|
||||||
notice_email_error: "发送邮件时发生错误 (%{value})"
|
notice_email_error: "发送邮件时发生错误 (%{value})"
|
||||||
notice_feeds_access_key_reseted: 您的RSS存取键已被重置。
|
notice_feeds_access_key_reseted: 您的RSS存取键已被重置。
|
||||||
notice_api_access_key_reseted: 您的API访问键已被重置。
|
notice_api_access_key_reseted: 您的API访问键已被重置。
|
||||||
|
|
Loading…
Reference in New Issue