parent
33fc193e65
commit
73798a0da4
|
@ -248,16 +248,9 @@ class ProjectsController < ApplicationController
|
|||
# 2、加入项目、创建角色
|
||||
# 3、用户得分
|
||||
if params[:login]
|
||||
login = params[:login]
|
||||
login = login.sub(/%40/,'@')
|
||||
mail = params[:login]
|
||||
password = params[:password]
|
||||
us = UsersService.new
|
||||
user = us.register_auto(login,mail, password)
|
||||
|
||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
|
||||
UserGrade.create(:user_id => user.id, :project_id => @project.id)
|
||||
User.current = user unless User.current.nil?
|
||||
# 自动激活用户
|
||||
user.status = 1
|
||||
user.save
|
||||
end
|
||||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
|
|
|
@ -33,7 +33,7 @@ class Mailer < ActionMailer::Base
|
|||
@target = cls
|
||||
end
|
||||
def method_missing(name, *args, &block)
|
||||
if Setting.delayjob_enabled && Object.const_defined?('Delayed')
|
||||
if Setting.delayjob_enabled? && Object.const_defined?('Delayed')
|
||||
@target.delay.send(name, *args, &block)
|
||||
else
|
||||
@target.send(name, *args, &block).deliver
|
||||
|
@ -52,9 +52,20 @@ class Mailer < ActionMailer::Base
|
|||
@email = email
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
@password = newpass(6)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,
|
||||
:password => @password,
|
||||
:login => email)
|
||||
|
||||
login = email
|
||||
login = login.sub(/%40/,'@')
|
||||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, @email, @password)
|
||||
|
||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id)
|
||||
UserGrade.create(:user_id => user.id, :project_id => project.id)
|
||||
User.current = user unless User.current.nil?
|
||||
@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, :subject => @subject
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class Principal < ActiveRecord::Base
|
|||
self.table_name = "#{table_name_prefix}users#{table_name_suffix}"
|
||||
|
||||
# Account statuses
|
||||
# 0 全部;1 活动的; 2 已注册; 3 锁定
|
||||
STATUS_ANONYMOUS = 0
|
||||
STATUS_ACTIVE = 1
|
||||
STATUS_REGISTERED = 2
|
||||
|
|
Loading…
Reference in New Issue