项目主页修改,我的账号,主页

This commit is contained in:
huangjingquan 2013-08-15 09:25:31 +08:00
parent 128150dd92
commit 37e9e8395c
4 changed files with 37 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# Redmine - project management software
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
@ -50,19 +50,34 @@ class MyController < ApplicationController
def account
@user = User.current
@pref = @user.pref
#Modified by young
unless @user.change_password_allowed?
flash[:error] = l(:notice_can_t_change_password)
redirect_to my_account_path
return
end
#Ended by young
if request.post?
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
#Added by young
if @user.check_password?(params[:password])
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
# redirect_to my_account_path
end
else
flash[:error] = l(:notice_account_wrong_password)
end
#Ended by young
if @user.save
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
@user.update_user_extensions()
flash[:notice] = l(:notice_account_updated)
redirect_to user_path(@user) #modified by huang/ my_account_path
redirect_to user_path(@user)
return
end
end
@ -88,9 +103,7 @@ class MyController < ApplicationController
# Manage user's password
def password
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
@user = User.current
@middle = "^"+@user.login.to_s+":"
unless @user.change_password_allowed?
flash[:error] = l(:notice_can_t_change_password)
redirect_to my_account_path
@ -99,8 +112,6 @@ class MyController < ApplicationController
if request.post?
if @user.check_password?(params[:password])
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
system "sed -i /"+@middle+"/{d} "+@root_path+"user.passwd"
system "htpasswd -mb "+@root_path+"user.passwd "+@user.login.to_s+" "+params[:new_password]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path

View File

@ -80,6 +80,15 @@
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
</div></div>
</div>
<!--tool-->

View File

@ -1,4 +1,4 @@
<div class="contextual" style="padding-right: 10px;">
<div class="contextual" style="padding-right: 10px;">
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
<%= call_hook(:view_my_account_contextual, :user => @user)%>
</div>
@ -14,10 +14,12 @@
</legend>
<div>
<!--upload profiles-->
<%= render :partial=> "avatar/avatar_form", :locals=>{source:@user} %>
<!--upload-->
</div>
</fieldset>
<%= labelled_form_for :user, @user,
:url => {:action => "account" },
:url => { :action => "account" },
:html => { :id => 'my_account_form',
:method => :post } do |f| %>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
@ -30,7 +32,7 @@
</p>
<p style="width:400px;padding-left: 26px;">
<%= f.text_field :lastname, :required => true %>
</p>
<p style="width:357px;padding-left: 26px;">
<%= f.text_field :mail, :required => true %>
</p>
@ -69,7 +71,6 @@
<%= render :partial => 'users/preferences' %></div>
</fieldset>
<%= submit_tag l(:button_save) %>
</fieldset>
<% end %>
<% html_title(l(:label_my_account)) %>
<% html_title(l(:label_my_account)) -%>

View File

@ -137,7 +137,7 @@ software development and software crowdsourcing.</td></tr>
<!--add by huang-->
<!--add by huang-->
<div style="height:190px;">
<div style="height:225px;">
<div class="welcone_left">
<table width="350px">
<tr>