Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
7a4127a3f7
|
@ -111,8 +111,7 @@ class AccountController < ApplicationController
|
||||||
user_params = params[:user] || {}
|
user_params = params[:user] || {}
|
||||||
@user = User.new
|
@user = User.new
|
||||||
@user.safe_attributes = user_params
|
@user.safe_attributes = user_params
|
||||||
#这里判断
|
if params[:identity] == "2" # 2 企业
|
||||||
if params[:identity] == "2"
|
|
||||||
@user.firstname = params[:enterprise_name]
|
@user.firstname = params[:enterprise_name]
|
||||||
@user.lastname = l(:field_enterprise)
|
@user.lastname = l(:field_enterprise)
|
||||||
end
|
end
|
||||||
|
@ -132,16 +131,6 @@ class AccountController < ApplicationController
|
||||||
@user.login = params[:user][:login]
|
@user.login = params[:user][:login]
|
||||||
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
|
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
|
||||||
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
|
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
|
||||||
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:user][:login]+" "+user_params[:password]
|
|
||||||
# system "echo -e '\n"+params[:user][:login]+"-write:"+
|
|
||||||
# " "+params[:user][:login]+"' >> "+@root_path+"group.passwd"
|
|
||||||
# system "mkdir "+@root_path+"htdocs/"+params[:user][:login]
|
|
||||||
#
|
|
||||||
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
|
|
||||||
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
|
|
||||||
# "Require group "+params[:user][:login]+"-write \n "+
|
|
||||||
# "</Limit> \n ' >>"+
|
|
||||||
# @root_path+"htdocs/"+params[:user][:login]+"/.htaccess"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
case Setting.self_registration
|
case Setting.self_registration
|
||||||
|
@ -183,6 +172,33 @@ class AccountController < ApplicationController
|
||||||
redirect_to signin_path
|
redirect_to signin_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ajax
|
||||||
|
req = Hash.new(false)
|
||||||
|
req[:message] = ''
|
||||||
|
|
||||||
|
valid_attr = params[:valid]
|
||||||
|
valid_value = params[:value]
|
||||||
|
|
||||||
|
faker = User.new
|
||||||
|
|
||||||
|
if valid_attr.eql?('login')
|
||||||
|
faker.login = valid_value
|
||||||
|
faker.valid?
|
||||||
|
req[:valid] = faker.errors[:login].blank?
|
||||||
|
req[:message] = faker.errors[:login]
|
||||||
|
end
|
||||||
|
|
||||||
|
if valid_attr.eql?('mail')
|
||||||
|
faker.mail = valid_value
|
||||||
|
faker.valid?
|
||||||
|
req[:valid] = faker.errors[:mail].blank?
|
||||||
|
req[:message] = faker.errors[:mail]
|
||||||
|
end
|
||||||
|
|
||||||
|
req[:message] = l(:modal_valid_passing) if req[:message].blank?
|
||||||
|
render :json => req
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def authenticate_user
|
def authenticate_user
|
||||||
|
|
|
@ -41,8 +41,21 @@ class SchoolController < ApplicationController
|
||||||
@provinces.each do |p|
|
@provinces.each do |p|
|
||||||
options << "<option value = '#{p.province}' >#{p.province}</option>"
|
options << "<option value = '#{p.province}' >#{p.province}</option>"
|
||||||
end
|
end
|
||||||
|
@school = School.all
|
||||||
|
|
||||||
|
|
||||||
|
options_s = ""
|
||||||
|
|
||||||
|
@school.each do |s|
|
||||||
|
#options << "<option value=#{s.id}>#{s.name}</option>"
|
||||||
|
options_s << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id, this.text)'>#{s.name}</a></li>"
|
||||||
|
end
|
||||||
|
res = Hash.new
|
||||||
|
res[:text] = options
|
||||||
|
res[:text_s] = options_s
|
||||||
|
|
||||||
|
render :json => res
|
||||||
|
|
||||||
render :text => options
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,8 +87,11 @@ class SchoolController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_school
|
def search_school
|
||||||
@school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
|
if params[:province].nil? or params[:province] == "0"
|
||||||
|
@school = School.where("name LIKE '%"+params[:key_word]+"%'");
|
||||||
|
else
|
||||||
|
@school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
|
||||||
|
end
|
||||||
options = ""
|
options = ""
|
||||||
@school.each do |s|
|
@school.each do |s|
|
||||||
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
||||||
|
|
|
@ -38,6 +38,7 @@ class UsersController < ApplicationController
|
||||||
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||||
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||||
:activity_score_index, :influence_score_index, :score_index]
|
:activity_score_index, :influence_score_index, :score_index]
|
||||||
|
before_filter :auth_user_extension, only: :show
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||||
|
|
||||||
#william
|
#william
|
||||||
|
@ -735,4 +736,11 @@ class UsersController < ApplicationController
|
||||||
def setting_layout(default_base='base_users')
|
def setting_layout(default_base='base_users')
|
||||||
User.current.admin? ? 'base_admin' : default_base
|
User.current.admin? ? 'base_admin' : default_base
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def auth_user_extension
|
||||||
|
if @user.user_extensions.school.nil?
|
||||||
|
flash[:error] = l(:error_complete_occupation)
|
||||||
|
redirect_to my_account_path
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -278,7 +278,7 @@
|
||||||
|
|
||||||
|
|
||||||
<% if @user.auth_source_id.nil? %>
|
<% if @user.auth_source_id.nil? %>
|
||||||
<p><%= f.text_field :login, :size => 25, :required => true %>
|
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
|
||||||
<em class="info"><%= l(:label_max_number) %></em></p>
|
<em class="info"><%= l(:label_max_number) %></em></p>
|
||||||
<p><%= f.password_field :password, :size => 25, :required => true %>
|
<p><%= f.password_field :password, :size => 25, :required => true %>
|
||||||
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
|
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
<td class="info" style="width: 10px">
|
<td class="info" style="width: 10px">
|
||||||
<%= text_field_tag :enterprise_name %></td></tr></table></p>
|
<%= text_field_tag :enterprise_name %></td></tr></table></p>
|
||||||
</span>
|
</span>
|
||||||
<p><%= f.text_field :mail, :required => true %></p>
|
<p><%= f.text_field :mail, :required => true %><span id="valid_user_mail"></span></p>
|
||||||
<p>
|
<p>
|
||||||
<em class="info"><%="#{l(:label_mail_attention)} "%></em></p>
|
<em class="info"><%="#{l(:label_mail_attention)} "%></em></p>
|
||||||
<p><%= f.select :language, lang_options_for_select , :required => true %></p>
|
<p><%= f.select :language, lang_options_for_select , :required => true %></p>
|
||||||
|
@ -368,3 +368,36 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var $login = $('#user_login')
|
||||||
|
var $mail = $('#user_mail')
|
||||||
|
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
$login.blur(function(event) {
|
||||||
|
var $parent = $(this).parent();
|
||||||
|
if ( $(this).is('#user_login')) {
|
||||||
|
$.get('<%=account_valid_ajax_path%>?valid=login&value='+this.value, function(data) {
|
||||||
|
if (data.valid) {
|
||||||
|
$('#valid_user_login').html('<span class="green">'+data.message+"</span>");
|
||||||
|
}else{
|
||||||
|
$('#valid_user_login').html('<span class="red">'+data.message+"</span>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
$mail.blur(function(event) {
|
||||||
|
var $parent = $(this).parent();
|
||||||
|
if ( $(this).is('#user_mail')) {
|
||||||
|
$.get('<%=account_valid_ajax_path%>?valid=mail&value='+this.value, function(data) {
|
||||||
|
if (data.valid) {
|
||||||
|
$('#valid_user_mail').html('<span class="green">'+data.message+"</span>");
|
||||||
|
}else{
|
||||||
|
$('#valid_user_mail').html('<span class="red">'+data.message+"</span>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
File diff suppressed because it is too large
Load Diff
|
@ -17,9 +17,9 @@
|
||||||
<% @admin = @project.project_infos%>
|
<% @admin = @project.project_infos%>
|
||||||
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
|
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
|
||||||
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
|
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
|
||||||
<% unless @project.course_extra.school.nil? %>
|
<%# unless @project.course_extra.school.nil? %>
|
||||||
<%= @project.course_extra.school.name %>
|
<%= @project.course_extra.teacher.user_extensions.school.try(:name) %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<p >
|
<p >
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#province").html("<option value='0' selected = true style='display: none;'></option>");
|
$("#province").html("<option value='0' selected = true style='display: none;'></option>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type :"POST",
|
type :"POST",
|
||||||
url :'/school/get_province',
|
url :'/school/get_province',
|
||||||
data :'text',
|
data: "send",
|
||||||
success: function(data){
|
success: function(data, textStatus){
|
||||||
$("#province").append(data);
|
|
||||||
|
$("#province").append(data.text);
|
||||||
|
$("#schoollist").html(data.text_s);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<p>
|
<p>
|
||||||
<%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted" %>
|
<%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted_bak" %>
|
||||||
<%= select_tag(
|
<%= select_tag(
|
||||||
'user[mail_notification]',
|
'user[mail_notification]',
|
||||||
options_for_select(
|
options_for_select(
|
||||||
|
|
|
@ -244,7 +244,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pagination" style="float:left;">
|
<div class="pagination" style="float:left;">
|
||||||
<ul> <%= pagination_links_full @info_pages %> <ul>
|
<ul> <%= pagination_links_full @info_pages %> </ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -1603,3 +1603,5 @@ en:
|
||||||
label_activity_time: publish date
|
label_activity_time: publish date
|
||||||
|
|
||||||
|
|
||||||
|
# ajax异步验证
|
||||||
|
modal_valid_passing: can be used.
|
|
@ -186,6 +186,8 @@ zh:
|
||||||
notice_issue_done_ratios_updated: 问题完成度已更新。
|
notice_issue_done_ratios_updated: 问题完成度已更新。
|
||||||
notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})"
|
notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})"
|
||||||
|
|
||||||
|
error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。"
|
||||||
|
|
||||||
error_can_t_load_default_data: "无法载入默认设置:%{value}"
|
error_can_t_load_default_data: "无法载入默认设置:%{value}"
|
||||||
error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。"
|
error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。"
|
||||||
error_scm_command_failed: "访问版本库时发生错误:%{value}"
|
error_scm_command_failed: "访问版本库时发生错误:%{value}"
|
||||||
|
@ -1884,3 +1886,6 @@ zh:
|
||||||
label_contest_settings: 配置竞赛
|
label_contest_settings: 配置竞赛
|
||||||
label_contest_delete: 删除竞赛
|
label_contest_delete: 删除竞赛
|
||||||
|
|
||||||
|
# ajax异步验证
|
||||||
|
modal_valid_passing: 可以使用
|
||||||
|
|
|
@ -126,6 +126,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
|
match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
|
||||||
match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
|
match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
|
||||||
match 'account/activate', :to => 'account#activate', :via => :get
|
match 'account/activate', :to => 'account#activate', :via => :get
|
||||||
|
match 'account/valid_ajax', :to => 'account#valid_ajax', :via => :get
|
||||||
|
|
||||||
match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
|
match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
|
||||||
match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
|
match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
/* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI
|
/* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
span[id^=valid_user]{
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
.red{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
.green{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
.border_box {
|
.border_box {
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
|
|
Loading…
Reference in New Issue