diff --git a/Gemfile b/Gemfile index eef93c371..bb94100a5 100644 --- a/Gemfile +++ b/Gemfile @@ -9,12 +9,11 @@ unless RUBY_PLATFORM =~ /w32/ gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel end gem 'certified' + gem 'net-ssh', '2.9.1' + gem 'jenkins_api_client' + gem 'nokogiri' end -gem 'net-ssh', '2.9.1' -gem 'jenkins_api_client' -gem 'nokogiri' - gem 'wechat',path: 'lib/wechat' gem 'grack', path:'lib/grack' gem 'gitlab', path: 'lib/gitlab-cli' diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 33d988e35..62b076754 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -239,14 +239,22 @@ class AccountController < ApplicationController end def resendmail + status = 1 user = User.find(params[:user]) if params[:user] token = Token.new(:user => user, :action => "register") if token.save - Mailer.run.register(token) - + # Mailer.run.register(token) + Mailer.register(token).deliver else yield if block_given? + status = 0 end + render :json => status + end + + def email_activation + + end private @@ -264,6 +272,7 @@ class AccountController < ApplicationController if user.nil? invalid_credentials elsif user.status == 2 + @user = user invalid_credentials_new elsif user.new_record? onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) @@ -375,8 +384,9 @@ class AccountController < ApplicationController def invalid_credentials_new logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" - flash[:error] = l(:notice_account_invalid_creditentials_new) - render signin_path(:login=>true) + # flash[:error] = l(:notice_account_invalid_creditentials_new) + # render signin_path(:login=>true) + render :action => 'email_activation' end # Register a user for email activation. diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 0883b3799..32c605516 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -127,12 +127,14 @@ class MyController < ApplicationController end @user.safe_attributes = params[:user] + @user.lastname = params[:lastname] + @user.firstname = "" @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') #@user.login = params[:login] unless @user.user_extensions.nil? if @user.user_extensions.identity == 2 - @user.firstname = params[:enterprise_name] + # @user.firstname = params[:enterprise_name] end end @@ -144,7 +146,7 @@ class MyController < ApplicationController # end @se.school_id = params[:occupation] - @se.gender = params[:gender] + @se.gender = params[:sex] @se.location = params[:province] if params[:province] @se.location_city = params[:city] if params[:city] @se.identity = params[:identity].to_i if params[:identity] diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index e0aff6254..44f4378fe 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -150,4 +150,55 @@ class SchoolController < ApplicationController format.js end end + + #申请高校(单位) name:名称 province:省 city:市 address:地址 remarks:备注 + def apply_add_school + + data = {result:0,name:params[:name],school_id:0} + #0 成功 1参数错误 2名称已存在 + data[:result] = 0 + + #检验参数 + if params[:name] == "" || params[:province] == "" || params[:city] == "" || params[:address] == "" + data[:result] = 1 + else + school_id = School.find_by_sql("select id from schools where name='#{params[:name]}'").first + if school_id + data[:result] = 2 + else + school = School.new + school.name = params[:name].strip + school.pinyin = Pinyin.t(params[:name].strip, splitter: '') + school.save + + #status 0未处理 1通过 2拒绝 + applyschool = ApplyAddSchools.new + applyschool.school_id = school.id + applyschool.name = school.name + applyschool.province = params[:province] + applyschool.city = params[:city] + applyschool.address = params[:address] + applyschool.remarks = params[:remarks] + applyschool.save + + data[:school_id] = school.id + end + end + render :json =>data + end + + def search_repeat_schoolname + status = 0 + name = params[:name] + + if name + school_id = School.find_by_sql("select id from schools where name='#{name}'").first + + if school_id + status = 1 + end + end + + render :json =>status + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b7972ff6f..2995d880d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1248,6 +1248,12 @@ class UsersController < ApplicationController render :layout=>'new_base_user' end + #给某人留言 + def feedBackTo + + + end + def user_comments end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 668269a26..93ba9e1ce 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -337,6 +337,27 @@ class WordsController < ApplicationController UserExtensions.introduction(user, message) redirect_to user_url(user.id) end + + #邮箱激活问题留言 留言成功给出提示框 + def leave_email_activation_message + status = 1 #成功 + me = User.find(params[:user]) + if me + #课程使者id=1 + @user = User.find(1) + if params[:text].size>0 && @user + # @user.add_jour(me, params[:text]) + #私信 + message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
"+params[:text] + @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + else + status = 0 + end + render :json => status + else + render_403 + end + end private diff --git a/app/models/apply_add_schools.rb b/app/models/apply_add_schools.rb new file mode 100644 index 000000000..2082c0012 --- /dev/null +++ b/app/models/apply_add_schools.rb @@ -0,0 +1,3 @@ +class ApplyAddSchools < ActiveRecord::Base + attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status +end diff --git a/app/views/account/email_activation.html.erb b/app/views/account/email_activation.html.erb new file mode 100644 index 000000000..d625e7fc9 --- /dev/null +++ b/app/views/account/email_activation.html.erb @@ -0,0 +1,52 @@ +
+
+ + + <%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %> + +
+
+ diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb deleted file mode 100644 index 0bebfdf5f..000000000 --- a/app/views/account/register.html.erb +++ /dev/null @@ -1,127 +0,0 @@ -<% @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 %> - \ No newline at end of file diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 7d8aaed86..b1cd86484 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -91,9 +91,10 @@
<%= format_time( @article.created_on)%>
-
- <%= @article.content.html_safe%> -
+ + + + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
<%#= link_to_attachments_course @topic, :author => false %> @@ -192,12 +193,12 @@
diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index ffec82bce..e2e935f57 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -16,7 +16,7 @@ <%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> - + <%= l(:label_submit)%> <% end %> @@ -25,7 +25,9 @@ <%#= l(:label_technical_support) %> -

请加入师姐师兄答疑群

QQ群号:173184401

+ + + Trustie师姐师兄答疑群
diff --git a/app/views/mailer/register.html.erb b/app/views/mailer/register.html.erb index 282deca90..5b4e8262b 100644 --- a/app/views/mailer/register.html.erb +++ b/app/views/mailer/register.html.erb @@ -1,2 +1,6 @@

<%= l(:mail_body_register) %>
<%= link_to h(@url), @url %>

+

如果点击链接无效请复制该链接到浏览器中打开

+
+

感谢您的使用!

+

Trustie团队

diff --git a/app/views/my/_apply_add_school.html.erb b/app/views/my/_apply_add_school.html.erb new file mode 100644 index 000000000..1449fa1f1 --- /dev/null +++ b/app/views/my/_apply_add_school.html.erb @@ -0,0 +1,337 @@ +

添加新的高校(单位)

+
+ + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 9cca5da5c..589541c39 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -15,14 +15,13 @@ <%= error_messages_for 'user',@user.user_extensions %> <% end %>