Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
ceb6ccf908
|
@ -40,6 +40,17 @@ module Mobile
|
|||
{status: 0}
|
||||
end
|
||||
|
||||
desc "忘记密码"
|
||||
params do
|
||||
requires :mail,type: String
|
||||
end
|
||||
post 'lost_password' do
|
||||
us = UsersService.new
|
||||
message = us.lost_password params
|
||||
present :message, message
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#coding=utf-8
|
||||
class CoursesService
|
||||
include ApplicationHelper
|
||||
include CoursesHelper
|
||||
|
@ -355,19 +354,19 @@ class CoursesService
|
|||
latest_course_dynamics = []
|
||||
latest_news = course.news.order("created_on desc").first
|
||||
unless latest_news.nil?
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => '最近更新了通知' }#l(:label_recently_updated_notification,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_message = course.journals_for_messages.order("created_on desc").first
|
||||
unless latest_message.nil?
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => '最近更新了留言'}#l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_attachment = course.attachments.order("created_on desc").first
|
||||
unless latest_attachment.nil?
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => '最近更新了课件'}#l(:label_recently_updated_courseware,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
||||
unless latest_bid.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => '最近更新了作业'}#l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
#每个作业中的最新留言
|
||||
messages = []
|
||||
|
|
|
@ -80,6 +80,28 @@ class UsersService
|
|||
{: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
|
||||
|
||||
#忘记密码
|
||||
def lost_password params
|
||||
user = ::User.find_by_mail(params[:mail].to_s)
|
||||
# user not found or not active
|
||||
unless user && user.active?
|
||||
raise l(:notice_account_unknown_email,:locale => 'zh')
|
||||
end
|
||||
# user cannot change its password
|
||||
unless user.change_password_allowed?
|
||||
raise l(:notice_can_t_change_password,:locale => user.language)
|
||||
return
|
||||
end
|
||||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
Thread.new do
|
||||
Mailer.lost_password(token).deliver
|
||||
end
|
||||
return l(:notice_account_lost_email_sent,:locale => user.language)
|
||||
end
|
||||
end
|
||||
|
||||
#编辑用户
|
||||
#gender 1:female 0:male 其他:male
|
||||
def edit_user params
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<%= link_to "#{@project.members.count}", project_member_path(@project), :style => "color:#3CA5C6;font-weight:bold" %></span>)
|
||||
<span>| </span>
|
||||
<%= l(:label_user_watcher) %>(<span class="info_foot_num">
|
||||
<%= link_to "#{@project.watcher_users.count}", :controller=>"projects", :action=>"watcherlist", :id => @project, :style => "color:#3CA5C6;font-weight:bold" %></span>)
|
||||
<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :style => "color:#3CA5C6;font-weight:bold" %></span>)
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments) %>(<span class="info_foot_num" >
|
||||
<%= link_to "#{@project.attachments.count}", project_files_path(@project), :style => "color:#3CA5C6;font-weight:bold" %></a>)</div>
|
||||
|
|
|
@ -2,19 +2,31 @@
|
|||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<span> <%= toggle_link ("+"+l(:label_add_tag)), 'put-tag-form', {:focus => 'tags_name'} %> </span>
|
||||
<span> <%= toggle_link (l(:label_add_tag)), 'put-tag-form', {:focus => 'tags_name'} %> </span>
|
||||
<% end %>
|
||||
<div id="put-tag-form" style="display: none;text-align: center">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form").slideUp();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "tags_name",:size=>"20",
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<%= f.text_field :name ,:id => "tags_name",:size=>"20",
|
||||
:require=>true,
|
||||
:maxlength => Setting.tags_max_length,
|
||||
:minlength=>Setting.tags_min_length %>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' type="button" class="submit f_l" style="margin-top: 10px;"></a>
|
||||
</td>
|
||||
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
|
||||
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
|
||||
<td style="margin-left: 5px">
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' type="button" class="submit f_l"></a>
|
||||
</td>
|
||||
<tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150305081132) do
|
||||
ActiveRecord::Schema.define(:version => 20150311013036) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
|
Loading…
Reference in New Issue