diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 4a4e0693..6541ed2c 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -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 diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 721b5e3b..45034667 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -80,7 +80,16 @@
- + + +
+ +
+
+ <%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%> +
+
+
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 05e1dfc1..9a75481a 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,4 +1,4 @@ -
+
<%= 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)%>
@@ -14,10 +14,12 @@
+ <%= render :partial=> "avatar/avatar_form", :locals=>{source:@user} %> +
<%= labelled_form_for :user, @user, - :url => {:action => "account" }, + :url => { :action => "account" }, :html => { :id => 'my_account_form', :method => :post } do |f| %>
<%= submit_tag l(:button_save) %> - <% end %> -<% html_title(l(:label_my_account)) %> +<% html_title(l(:label_my_account)) -%> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 8ca94e94..5fb21221 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -137,7 +137,7 @@ software development and software crowdsourcing. -
+