parent
4bfc4493eb
commit
aa8f58530c
|
@ -249,6 +249,17 @@ class ProjectsController < ApplicationController
|
||||||
# Description 项目动态展示方法,删除了不必要的代码
|
# Description 项目动态展示方法,删除了不必要的代码
|
||||||
def show
|
def show
|
||||||
# 试图跳转到请求的按钮
|
# 试图跳转到请求的按钮
|
||||||
|
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?
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,6 +27,17 @@ class Mailer < ActionMailer::Base
|
||||||
{ :host => Setting.host_name, :protocol => Setting.protocol }
|
{ :host => Setting.host_name, :protocol => Setting.protocol }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# author: alan
|
||||||
|
# 发送邀请未注册用户加入项目邮件
|
||||||
|
# 功能: 在加入项目的同时自动注册用户
|
||||||
|
def send_invite_in_project(email, project, invitor)
|
||||||
|
@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)
|
||||||
|
mail :to => email, :subject => @subject
|
||||||
|
end
|
||||||
|
|
||||||
# author: alan
|
# author: alan
|
||||||
# 根据用户选择发送个人日报或周报
|
# 根据用户选择发送个人日报或周报
|
||||||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||||
|
@ -828,4 +839,13 @@ class Mailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# author: alan
|
||||||
|
# 功能: 生成len位随机字符串
|
||||||
|
def newpass(len)
|
||||||
|
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
||||||
|
newpass = ""
|
||||||
|
1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
|
||||||
|
return newpass
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,6 @@ class MemoObserver < ActiveRecord::Observer
|
||||||
|
|
||||||
thread1=Thread.new do
|
thread1=Thread.new do
|
||||||
Mailer.forum_message_added(memo).deliver if Setting.notified_events.include?('forum_message_added')
|
Mailer.forum_message_added(memo).deliver if Setting.notified_events.include?('forum_message_added')
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,7 +44,31 @@ class UsersService
|
||||||
#location = get_user_location @user
|
#location = get_user_location @user
|
||||||
#{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
|
#{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
|
||||||
end
|
end
|
||||||
|
def register_auto(login,mail,password)
|
||||||
|
@user = User.new
|
||||||
|
@user.admin = false
|
||||||
|
@user.register
|
||||||
|
@user.login = login
|
||||||
|
@user.mail =mail
|
||||||
|
password_confirmation = password
|
||||||
|
should_confirmation_password = true
|
||||||
|
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
||||||
|
@user.password, @user.password_confirmation = password, password_confirmation
|
||||||
|
elsif !password.blank? && !should_confirmation_password
|
||||||
|
@user.password = password
|
||||||
|
else
|
||||||
|
@user.password = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
@user = automatically_register(@user)
|
||||||
|
|
||||||
|
if @user.id != nil
|
||||||
|
ue = @user.user_extensions ||= UserExtensions.new
|
||||||
|
ue.user_id = @user.id
|
||||||
|
ue.save
|
||||||
|
end
|
||||||
|
@user
|
||||||
|
end
|
||||||
#显示用户
|
#显示用户
|
||||||
#id用户id
|
#id用户id
|
||||||
def show_user(params)
|
def show_user(params)
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
|
||||||
|
<ul style="list-style-type:none; margin:0; padding:0;">
|
||||||
|
|
||||||
|
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||||
|
<span style="float: left; width: 526px">
|
||||||
|
<p><%= @subject %> </p>
|
||||||
|
<p> <%= link_to @project_url, @project_url%></p>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
<%= @subject %>
|
||||||
|
<%= link_to @project_url, @project_url%>
|
|
@ -1917,6 +1917,7 @@ zh:
|
||||||
|
|
||||||
label_bids_task_list: 作业列表
|
label_bids_task_list: 作业列表
|
||||||
label_join_course: 加入
|
label_join_course: 加入
|
||||||
|
label_invite_project: 邀请您加入项目
|
||||||
label_exit_course: 退出
|
label_exit_course: 退出
|
||||||
label_exit_group: 退出当前分班
|
label_exit_group: 退出当前分班
|
||||||
label_new_join: 加入
|
label_new_join: 加入
|
||||||
|
|
Loading…
Reference in New Issue