|
|
|
@ -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
|
|
|
|
@ -10,7 +10,7 @@
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
#+
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
@ -50,10 +50,12 @@ class MyController < ApplicationController
|
|
|
|
|
def account
|
|
|
|
|
@user = User.current
|
|
|
|
|
@pref = @user.pref
|
|
|
|
|
|
|
|
|
|
if request.post?
|
|
|
|
|
@user.safe_attributes = params[:user]
|
|
|
|
|
@user.pref.attributes = params[:pref]
|
|
|
|
|
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
|
|
|
|
|
|
|
|
|
if @user.save
|
|
|
|
|
@user.pref.save
|
|
|
|
|
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
|
|
|
@ -85,7 +87,9 @@ 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
|
|
|
|
@ -94,6 +98,9 @@ class MyController < ApplicationController
|
|
|
|
|
if request.post?
|
|
|
|
|
if @user.check_password?(params[:password])
|
|
|
|
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
|
|
|
|
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
|
|
|
|
|
system "sed -i /"+@middle+"/{d} "+@root_path+"user.passwd"
|
|
|
|
|
system "htpasswd -mb "+@root_path+"user.passwd "+@user.login.to_s+" "+params[:new_password]
|
|
|
|
|
system "echo -e '\n"+@user.login.to_s+"-write:"+
|
|
|
|
|
" "+@user.login.to_s+"' >> "+@root_path+"group.passwd"
|
|
|
|
|
system "mkdir "+@root_path+"htdocs/"+@user.login.to_s
|
|
|
|
|