Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -21,13 +23,17 @@ class MyController < ApplicationController
|
|||
# let user change user's password when user has to
|
||||
skip_before_action :check_password_change, :only => :password
|
||||
|
||||
require_sudo_mode :account, only: :post
|
||||
accept_api_auth :account
|
||||
|
||||
require_sudo_mode :account, only: :put
|
||||
require_sudo_mode :reset_rss_key, :reset_api_key, :show_api_key, :destroy
|
||||
|
||||
helper :issues
|
||||
helper :users
|
||||
helper :custom_fields
|
||||
helper :queries
|
||||
helper :activities
|
||||
helper :calendars
|
||||
|
||||
def index
|
||||
page
|
||||
|
@ -45,15 +51,25 @@ class MyController < ApplicationController
|
|||
def account
|
||||
@user = User.current
|
||||
@pref = @user.pref
|
||||
if request.post?
|
||||
if request.put?
|
||||
@user.safe_attributes = params[:user]
|
||||
@user.pref.safe_attributes = params[:pref]
|
||||
if @user.save
|
||||
@user.pref.save
|
||||
set_language_if_valid @user.language
|
||||
flash[:notice] = l(:notice_account_updated)
|
||||
redirect_to my_account_path
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_account_updated)
|
||||
redirect_to my_account_path
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
return
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => :account }
|
||||
format.api { render_validation_errors(@user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -95,7 +111,7 @@ class MyController < ApplicationController
|
|||
if @user.save
|
||||
# The session token was destroyed by the password change, generate a new one
|
||||
session[:tk] = @user.generate_session_token
|
||||
Mailer.password_updated(@user)
|
||||
Mailer.deliver_password_updated(@user, User.current)
|
||||
flash[:notice] = l(:notice_account_password_updated)
|
||||
redirect_to my_account_path
|
||||
end
|
||||
|
@ -138,7 +154,7 @@ class MyController < ApplicationController
|
|||
block_settings = params[:settings] || {}
|
||||
|
||||
block_settings.each do |block, settings|
|
||||
@user.pref.update_block_settings(block, settings)
|
||||
@user.pref.update_block_settings(block, settings.to_unsafe_hash)
|
||||
end
|
||||
@user.pref.save
|
||||
@updated_blocks = block_settings.keys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue