From 13bf91f954244578275c9f7d02bee56ad314ebb1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 15:50:14 +0800 Subject: [PATCH 1/8] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E4=B8=AD=E3=80=81=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E3=80=81=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E3=80=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=AD=89=E6=8C=89=E9=92=AE=E4=B8=8D=E8=A7=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BF=AE=E6=94=B9=E5=8C=BF=E8=AF=84=E3=80=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=84=E8=AE=BA=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 1 - db/schema.rb | 3 ++- public/stylesheets/css.css | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 8a6b276b3..c29b784b0 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -28,7 +28,6 @@ color: #fff; text-align: center; padding: 5px !important; - display: none; } .span_wping a:hover{ background-color:#03a1b3;} diff --git a/db/schema.rb b/db/schema.rb index 2e664eaa7..973e2afbe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20141119011439) do +ActiveRecord::Schema.define(:version => 20141120091234) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,7 @@ ActiveRecord::Schema.define(:version => 20141119011439) do t.string "disk_directory" t.integer "attachtype", :default => 1 t.integer "is_public", :default => 1 + t.integer "copy_from" end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 19b68743a..b85b6ae73 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -42,7 +42,7 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;} .dis ul li.wdown a{padding-top:25px; color:#3d7ec2; margin-right:35px;} .wscore{ padding-top:25px; color:#888888; width:96px;} .dis ul li.wping{margin-left:12px; } -.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;} +.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:8px;} .dis ul li.wping a:hover{ background-color:#03a1b3;} ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-height: 1.9; } .wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} @@ -84,7 +84,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} .ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} -a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} +a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;line-height: 1.9;} a:hover.ping_sub{ background:#14a8b9;} .recall{ border-top:1px solid #CCC; padding:5px 0;} .recall_head{ float:left;} From ca7b56cbf005e12a8a9042fe5ce30c8bb5e129d8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 15:56:42 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=8F=90=E4=BA=A4=E5=A4=A7=E4=BA=8E=E7=AD=89=E4=BA=8E?= =?UTF-8?q?2=E4=BB=BD=E6=97=B6=E6=89=8D=E6=98=BE=E7=A4=BA=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/layouts/base_homework.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index c29b784b0..107ee5bba 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -75,7 +75,7 @@ <% end %> <% end %> <% if (User.current.admin?||User.current.id==bid.author_id) %> - <% if bid.open_anonymous_evaluation == 1%> + <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> <% case bid.comment_status %> <% when 0 %> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 811540323..c3028c8f1 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -118,7 +118,7 @@ <% if (User.current.admin?||User.current.id==@bid.author_id) %> - <% if @bid.open_anonymous_evaluation == 1%> + <% if @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2%> <% case @bid.comment_status %> <% when 0 %> From 88ab53730b831fb9a06f43ad19bd1b96ad47d9aa Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 22 Nov 2014 17:45:09 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index fe6222359..48254ef90 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -364,7 +364,9 @@ class User < Principal end end end - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + unless user.nil? + last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + end user.update_column(:last_login_on, Time.now) if user && !user.new_record? [user, last_login_on] rescue => text From 3417b2bce198677f3e303b358d275ba9ffe95571 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 22 Nov 2014 22:50:48 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E3=80=8A=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=B7=B3=E8=BD=AC=E3=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alan <547533434@qq.com> --- app/controllers/account_controller.rb | 30 ++++++++++++--------------- app/models/user.rb | 8 +++---- app/views/account/login.html.erb | 5 ++++- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index b5975e452..aedfc7407 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -234,7 +234,7 @@ class AccountController < ApplicationController end def password_authentication - user, last_login_on = User.try_to_login(params[:username], params[:password]) + user = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +244,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user, last_login_on) + successful_authentication(user) end end @@ -291,7 +291,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user, last_login_on) + def successful_authentication(user) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -302,20 +302,16 @@ class AccountController < ApplicationController call_hook(:controller_account_success_authentication_after, {:user => user }) code = /\d*/ - #根据home_url生产正则表达式 - eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] && last_login_on != '' - redirect_to user_activities_path(user) - else - if last_login_on == '' - redirect_to my_account_url - else - #by young - #redirect_back_or_default my_page_path - #sredirect_back_or_default User.current - redirect_to my_account_url - #redirect_to User.current - end + #根据home_url生产正则表达式 + eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") + if code=~params[:back_url] + redirect_to user_activities_path(user) + else + + #by young + #redirect_back_or_default my_page_path + redirect_back_or_default User.current + end end diff --git a/app/models/user.rb b/app/models/user.rb index 48254ef90..8e6f121b0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -364,11 +364,11 @@ class User < Principal end end end - unless user.nil? - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + if user && !user.new_record? + #last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + user.update_column(:last_login_on, Time.now) end - user.update_column(:last_login_on, Time.now) if user && !user.new_record? - [user, last_login_on] + user rescue => text raise text end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 1115ca80e..4175282b3 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -20,7 +20,10 @@ } } - + + + +
<%= form_tag(signin_path) do %> <%= back_url_hidden_field_tag %> From 949867c50bf9cec009a65b17fb4f8e8167ca71bd Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 09:36:47 +0800 Subject: [PATCH 5/8] Signed-off-by: alan <547533434@qq.com> --- app/controllers/account_controller.rb | 30 +++++++++++++++------------ app/models/user.rb | 4 ++-- public/javascripts/application.js | 8 +++++++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index aedfc7407..279e89f13 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -234,7 +234,7 @@ class AccountController < ApplicationController end def password_authentication - user = User.try_to_login(params[:username], params[:password]) + user, last_login_on = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +244,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user) + successful_authentication(user, last_login_on) end end @@ -291,7 +291,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user) + def successful_authentication(user, last_login_on) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -302,16 +302,20 @@ class AccountController < ApplicationController call_hook(:controller_account_success_authentication_after, {:user => user }) code = /\d*/ - #根据home_url生产正则表达式 - eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] - redirect_to user_activities_path(user) - else - - #by young - #redirect_back_or_default my_page_path - redirect_back_or_default User.current - + #根据home_url生产正则表达式 + eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") + if code=~params[:back_url] && last_login_on != '' + redirect_to user_activities_path(user) + else + if last_login_on == '' + redirect_to my_account_url + else + #by young + #redirect_back_or_default my_page_path + redirect_back_or_default User.current + #redirect_to my_account_url + #redirect_to User.current + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 8e6f121b0..29709519d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -365,10 +365,10 @@ class User < Principal end end if user && !user.new_record? - #last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s user.update_column(:last_login_on, Time.now) end - user + [user, last_login_on] rescue => text raise text end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 57e3e32b8..42f345d15 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2,6 +2,14 @@ /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */ +$(function() { + $.ajaxSetup({ + beforeSend: function ( xhr ) { + xhr.setRequestHeader("Accept", "text/javascript") + } + }) +} + function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){ From 6963d494ae73e426c40df93d5665eee3015f5aff Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 10:44:51 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E3=80=8A=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 48 +- app/models/user.rb | 27 +- app/views/account/login.html.erb | 40 +- app/views/account/register.html.erb | 615 +++++++++--- app/views/my/account.html.erb | 1301 +++++++++++-------------- 5 files changed, 1102 insertions(+), 929 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 279e89f13..2e9ac74c5 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -66,7 +66,7 @@ class AccountController < ApplicationController if @user.save @token.destroy flash[:notice] = l(:notice_account_password_updated) - redirect_to signin_url + redirect_to signin_path return end end @@ -92,7 +92,7 @@ class AccountController < ApplicationController Mailer.lost_password(token).deliver end flash[:notice] = l(:notice_account_lost_email_sent) - redirect_to signin_url + redirect_to signin_path return end end @@ -103,7 +103,7 @@ class AccountController < ApplicationController def register # @root_path="/home/pdl/redmine-2.3.2-0/apache2/" # - #@cache_identityy = params[:identity]||"" #身份 + @cache_identityy = params[:identity]||"" #身份 @cache_no = params[:no]||"" #学号 @cache_technical_title = params[:technical_title]||"" #教师职称 @cache_province = params[:province]||"" #省份 @@ -144,7 +144,22 @@ class AccountController < ApplicationController @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] end - + if(@cache_identityy == "") + if params[:identity] == "2" + @user.firstname = firstname_code + @user.lastname = lastname_code + end + flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty') + return + end + if(@cache_city == "") + if params[:identity] == "2" + @user.firstname = firstname_code + @user.lastname = lastname_code + end + flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty') + return + end case Setting.self_registration when '1' @@ -189,7 +204,7 @@ class AccountController < ApplicationController token.destroy flash[:notice] = l(:notice_account_activated) end - redirect_to signin_url + redirect_to signin_path end def valid_ajax @@ -219,10 +234,6 @@ class AccountController < ApplicationController render :json => req end - def email_valid - - end - private def authenticate_user @@ -234,7 +245,7 @@ class AccountController < ApplicationController end def password_authentication - user, last_login_on = User.try_to_login(params[:username], params[:password]) + user = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +255,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user, last_login_on) + successful_authentication(user) end end @@ -291,7 +302,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user, last_login_on) + def successful_authentication(user) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -304,18 +315,13 @@ class AccountController < ApplicationController code = /\d*/ #根据home_url生产正则表达式 eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] && last_login_on != '' + if code=~params[:back_url] redirect_to user_activities_path(user) else - if last_login_on == '' - redirect_to my_account_url - else #by young #redirect_back_or_default my_page_path redirect_back_or_default User.current - #redirect_to my_account_url #redirect_to User.current - end end end @@ -357,7 +363,7 @@ class AccountController < ApplicationController UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) Mailer.register(token).deliver flash[:notice] = l(:notice_account_register_done) - render action: 'email_valid', locals: {:mail => user.mail} + redirect_to signin_path else yield if block_given? end @@ -374,7 +380,7 @@ class AccountController < ApplicationController UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) self.logged_user = user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_url + redirect_to my_account_path else yield if block_given? end @@ -396,6 +402,6 @@ class AccountController < ApplicationController def account_pending flash[:notice] = l(:notice_account_pending) - redirect_to signin_url + redirect_to signin_path end end diff --git a/app/models/user.rb b/app/models/user.rb index 29709519d..78bfc75f0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -75,7 +75,6 @@ class User < Principal has_many :homework_users has_many :homework_attaches, :through => :homework_users - has_many :homework_evaluations has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, :after_remove => Proc.new {|user, group| group.user_removed(user)} @@ -168,7 +167,7 @@ class User < Principal LOGIN_LENGTH_LIMIT = 25 MAIL_LENGTH_LIMIT = 60 - validates_presence_of :login, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } + validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false # Login must contain letters, numbers, underscores only @@ -199,19 +198,13 @@ class User < Principal } scope :sorted, lambda { order(*User.fields_for_order_statement)} - scope :like, lambda {|arg, type| + scope :like, lambda {|arg| if arg.blank? where(nil) else pattern = "%#{arg.to_s.strip.downcase}%" #where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) - if type == "0" - where(" LOWER(login) LIKE :p ", :p => pattern) - elsif type == "1" - where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) - else - where(" LOWER(mail) LIKE :p ", :p => pattern) - end + where(" LOWER(login) LIKE :p ", :p => pattern) end } @@ -230,12 +223,7 @@ class User < Principal #选择项目成员时显示的用户信息文字 def userInfo - if self.realname.gsub(' ','') == "" || self.realname.nil? - info = self.nickname; - else - info=self.nickname + ' (' + self.realname + ')'; - end - info + info=self.nickname + ' (' + self.realname + ')'; end ###添加留言 fq @@ -364,11 +352,8 @@ class User < Principal end end end - if user && !user.new_record? - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s - user.update_column(:last_login_on, Time.now) - end - [user, last_login_on] + user.update_column(:last_login_on, Time.now) if user && !user.new_record? + user rescue => text raise text end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 4175282b3..20b0c5c04 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -20,20 +20,13 @@ } } - - - - +
<%= form_tag(signin_path) do %> <%= back_url_hidden_field_tag %> - + - - + + <% if Setting.openid? %> - - + + <% end %>
- - <%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}", :onfocus => "clearInfo('username','#{l(:label_login_prompt)}')", @@ -42,48 +35,33 @@
- - - <%= password_field_tag 'password', nil, :tabindex => '2' %> - <%= password_field_tag 'password', nil, :tabindex => '2' %>
- - - <%= text_field_tag "openid_url", nil, :tabindex => '3' %> - <%= text_field_tag "openid_url", nil, :tabindex => '3' %>
<% if Setting.autologin? %> - + <% end %>
- - <% if Setting.lost_password? %> + <% if Setting.lost_password? %> <%= link_to l(:label_password_lost), lost_password_path %> <% end %> +
diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 0bebfdf5f..21c8c11b9 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,127 +1,490 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - - - -

<%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

- -<%= labelled_form_for @user, :url => register_path do |f| %> - <%= error_messages_for 'user' %> -
- - <% if @user.auth_source_id.nil? %> -

<%= f.text_field :login, :size => 25, :required => true %> - <%= l(:label_max_number) %> -

-

<%= f.password_field :password, :size => 25, :required => true %> - <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %> -

-

<%= f.password_field :password_confirmation, :size => 25, :required => true %>

- <% end %> - -

- <%= f.text_field :mail,:size => 25, :required => true %> - -

-

- -

<%= "#{l(:label_mail_attention)} " %>

-

<%= "#{l(:label_mail_attention1)} " %>

-
-

- - - - -
- -

- - - - -
<%= submit_tag l(:button_submit) %>
-

-<% end %> -<% if Setting.openid? %> -

<%= f.text_field :identity_url %>

-<% end %> -<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> -

<%= custom_field_tag_with_label :user, value %>

-<% end %> -
-<% password_min_length = Setting.password_min_length %> - + + + + + +

<%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

+ +<%= labelled_form_for @user, :url => register_path do |f| %> + <%= error_messages_for 'user' %> + +
+

+ + + + + + +
+ <%= l(:label_identity) %> * + + + + +<% else %> +<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> +<% end %> +
+

+ + <% if @user.auth_source_id.nil? %> +

<%= f.text_field :login, :size => 25, :required => true %> + <%= l(:label_max_number) %>

+ +

<%= f.password_field :password, :size => 25, :required => true %> + <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>

+ +

<%= f.password_field :password_confirmation, :size => 25, :required => true %>

+ <% end %> + + + +

<%= f.text_field :mail, :required => true %>

+ +

+ <%= "#{l(:label_mail_attention)} " %>

+ +

<%= f.select :language, lang_options_for_select, :required => true %>

+ + + + + + +

+ + + + + + +
+ <%= l(:label_location) %> * + + + + +
+

+ +
+ +

+ + + + +
<%= submit_tag l(:button_submit) %>
+

+<% end %> + +<% if Setting.openid? %> +

<%= f.text_field :identity_url %>

+<% end %> + + +<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> +

<%= custom_field_tag_with_label :user, value %>

+<% end %> +
+ + + + \ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 277a6eaca..a57e35e65 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,731 +1,572 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - -
- <%= 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) %> -
- -

- <%= l(:label_my_account) %> -

-<%= error_messages_for 'user' %> -
-<%= labelled_form_for :user, @user, - :url => {:action => "account"}, - :html => {:id => 'my_account_form', - - :method => :post} do |f| %> - - - - - - - - - <%= submit_tag l(:button_save) %> -
-<% end %> -<% html_title(l(:label_my_account)) -%> - - + + + + + + +
+ <%= 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) %> +
+ +

<%= l(:label_my_account) %>

+<%= error_messages_for 'user' %> + +
+ +<%= labelled_form_for :user, @user, + :url => {:action => "account"}, + :html => {:id => 'my_account_form', + :method => :post} do |f| %> + + + + + + + + + <%= submit_tag l(:button_save) %> +
+<% end %> +<% html_title(l(:label_my_account)) -%> + + \ No newline at end of file From 4221f5edb310287f07f005945f70b4a48ad9a1c2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 11:48:59 +0800 Subject: [PATCH 7/8] =?UTF-8?q?<=E8=BF=98=E5=8E=9F>=20Signed-off-by:=20ala?= =?UTF-8?q?n=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32cfefa9d..cab5ada7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base else # HTTP Basic, either username/password or API key/random authenticate_with_http_basic do |username, password| - user = User.try_to_login(username, password)[0] || User.find_by_api_key(username) + user = User.try_to_login(username, password) || User.find_by_api_key(username) end end # Switch user if requested by an admin user From 90e4387395a918ce3e9ef7954872e5b719377885 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 24 Nov 2014 09:08:49 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=20Sign?= =?UTF-8?q?ed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 1 + public/javascripts/application.js | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4ba8ecf6c..6916219a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,6 +125,7 @@ GEM mocha (1.1.0) metaclass (~> 0.0.1) multi_json (1.10.1) + mysql2 (0.3.11) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) nokogiri (1.6.3) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 42f345d15..7e8080a4a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2,13 +2,7 @@ /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */ -$(function() { - $.ajaxSetup({ - beforeSend: function ( xhr ) { - xhr.setRequestHeader("Accept", "text/javascript") - } - }) -} + function cleanArray (actual){ var newArray = new Array(); @@ -397,6 +391,7 @@ function submitPreview(url, form, target) { $.ajax({ url: url, type: 'post', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: $('#'+form).serialize(), success: function(data){ $('#'+target).html(data); @@ -441,6 +436,7 @@ function scmEntryClick(id, url) { el.addClass('loading'); $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, success: function(data){ el.after(data); el.addClass('open').addClass('loaded').removeClass('loading'); @@ -462,6 +458,7 @@ function randomKey(size) { function updateIssueFrom(url) { $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, type: 'post', data: $('#issue-form').serialize() }); @@ -470,6 +467,7 @@ function updateIssueFrom(url) { function updateBulkEditFrom(url) { $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, type: 'post', data: $('#bulk_edit_form').serialize() }); @@ -508,6 +506,7 @@ function observeSearchfield(fieldId, targetId, url) { $.ajax({ url: url, type: 'get', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: {q: $this.val()}, success: function(data){ if(targetId) $('#'+targetId).html(data); }, beforeSend: function(){ $this.addClass('ajax-loading'); }, @@ -548,6 +547,7 @@ function initMyPageSortable(list, url) { $.ajax({ url: url, type: 'post', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} }); } @@ -629,6 +629,14 @@ function transpotUrl (scope) { $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad); $(document).ready(addFormObserversForDoubleSubmit); +$(document).ready(function(){ + $.ajaxSetup({ + headers: { + 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') + } + }); + } +) function img_thumbnails() { $('.thumbnails a').colorbox({rel:'nofollow'});