forked from Gitlink/forgeplus
Merge branch 'develop' of http://git.trustie.net/jasder/forgeplus into develop
This commit is contained in:
commit
639cb22185
|
@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
|
|||
include RenderExpand
|
||||
include RenderHelper
|
||||
include ControllerRescueHandler
|
||||
# include LaboratoryHelper
|
||||
include LaboratoryHelper
|
||||
include GitHelper
|
||||
include LoggerHelper
|
||||
include LoginHelper
|
||||
|
@ -23,23 +23,23 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# 所有请求必须合法签名
|
||||
def check_sign
|
||||
if !Rails.env.development?
|
||||
Rails.logger.info("66666 #{params}")
|
||||
# suffix = request.url.split(".").last.split("?").first
|
||||
# suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释
|
||||
# unless suffix_arr.include?(suffix)
|
||||
if params[:client_key].present?
|
||||
randomcode = params[:randomcode]
|
||||
# tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
|
||||
|
||||
sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
|
||||
Rails.logger.info("2222 #{sign}")
|
||||
tip_exception(501, "请求不合理") if sign != params[:client_key]
|
||||
else
|
||||
tip_exception(501, "请求不合理")
|
||||
end
|
||||
# end
|
||||
end
|
||||
# if !Rails.env.development?
|
||||
# Rails.logger.info("66666 #{params}")
|
||||
# # suffix = request.url.split(".").last.split("?").first
|
||||
# # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释
|
||||
# # unless suffix_arr.include?(suffix)
|
||||
# if params[:client_key].present?
|
||||
# randomcode = params[:randomcode]
|
||||
# # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
|
||||
#
|
||||
# sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
|
||||
# Rails.logger.info("2222 #{sign}")
|
||||
# tip_exception(501, "请求不合理") if sign != params[:client_key]
|
||||
# else
|
||||
# tip_exception(501, "请求不合理")
|
||||
# end
|
||||
# # end
|
||||
# end
|
||||
end
|
||||
|
||||
# 全局配置参数
|
||||
|
|
|
@ -29,4 +29,4 @@ module LaboratoryHelper
|
|||
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
||||
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,25 +29,6 @@ class UsersController < ApplicationController
|
|||
@user = current_user
|
||||
# TODO 等消息上线再打开注释
|
||||
#@tidding_count = unviewed_tiddings(current_user) if current_user.present?
|
||||
@course =
|
||||
if params[:course_id]
|
||||
Course.find params[:course_id]
|
||||
elsif params[:board_id]
|
||||
Board.find(params[:board_id]).course
|
||||
elsif params[:graduation_topic_id]
|
||||
GraduationTopic.find(params[:graduation_topic_id]).course
|
||||
elsif params[:graduation_group_id]
|
||||
GraduationGroup.find(params[:graduation_group_id]).course
|
||||
elsif params[:graduation_work_id]
|
||||
GraduationWork.find(params[:graduation_work_id]).course
|
||||
elsif params[:graduation_task_id]
|
||||
GraduationTask.find(params[:graduation_task_id]).course
|
||||
elsif params[:poll_id]
|
||||
Poll.find(params[:poll_id]).course
|
||||
elsif params[:attachment_id]
|
||||
Attachment.find(params[:attachment_id]).course
|
||||
end
|
||||
@course_identity = current_user.course_identity(@course) if @course
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
missing_template
|
||||
|
@ -72,14 +53,14 @@ class UsersController < ApplicationController
|
|||
|
||||
# Redo: 消息总数缓存
|
||||
def get_navigation_info
|
||||
@old_domain = edu_setting('old_edu_host')
|
||||
@user = current_user
|
||||
# 新消息数
|
||||
@new_message = @user.tidings.where("created_at > '#{@user.click_time}'").count > 0 || @user.private_messages.where("created_at > '#{@user.click_time}'").count > 0
|
||||
|
||||
@user_url = "/users/#{@user.login}"
|
||||
@career = Career.where(status: true).order("created_at asc").pluck(:id, :name)
|
||||
@auth = User.current.ec_school.present? ? "#{@old_domain}/ecs/department?school_id=#{User.current.ec_school}" : nil
|
||||
# @old_domain = edu_setting('old_edu_host')
|
||||
# @user = current_user
|
||||
# # 新消息数
|
||||
# @new_message = @user.tidings.where("created_at > '#{@user.click_time}'").count > 0 || @user.private_messages.where("created_at > '#{@user.click_time}'").count > 0
|
||||
#
|
||||
# @user_url = "/users/#{@user.login}"
|
||||
# @career = Career.where(status: true).order("created_at asc").pluck(:id, :name)
|
||||
# @auth = User.current.ec_school.present? ? "#{@old_domain}/ecs/department?school_id=#{User.current.ec_school}" : nil
|
||||
end
|
||||
|
||||
# 用户回复功能
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
class LimitForbidControl::Base
|
||||
def initialize
|
||||
end
|
||||
|
||||
def cache_key
|
||||
raise 'Please overwrite method :cache_Key'
|
||||
end
|
||||
|
||||
def forbid_cache_key
|
||||
"#{cache_key}:forbid"
|
||||
end
|
||||
|
||||
def allow_times
|
||||
5
|
||||
end
|
||||
|
||||
def cumulative_expires
|
||||
1.days
|
||||
end
|
||||
|
||||
def forbid_expires
|
||||
1.hours
|
||||
end
|
||||
|
||||
def forbid?
|
||||
Rails.cache.read(forbid_cache_key)
|
||||
end
|
||||
|
||||
def increment!
|
||||
value = Rails.cache.read(cache_key)
|
||||
value = value.to_i + 1
|
||||
|
||||
# 锁定
|
||||
if value >= allow_times.to_i
|
||||
Rails.logger.info("[LimitForbidControl] Lock #{cache_key}")
|
||||
Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires)
|
||||
Rails.cache.delete(cache_key)
|
||||
else
|
||||
Rails.cache.write(cache_key, value, expires_in: cumulative_expires)
|
||||
end
|
||||
end
|
||||
|
||||
def error_times
|
||||
Rails.cache.read(cache_key).to_i
|
||||
end
|
||||
|
||||
def remain_times
|
||||
allow_times.to_i - error_times
|
||||
end
|
||||
|
||||
def clear
|
||||
Rails.logger.info("[LimitForbidControl] Clear #{cache_key}")
|
||||
Rails.cache.delete(forbid_cache_key)
|
||||
Rails.cache.delete(cache_key)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def redis_cache?
|
||||
Rails.cache.is_a?(ActiveSupport::Cache::RedisStore)
|
||||
end
|
||||
|
||||
def day
|
||||
Time.current.strftime('%Y%m%d')
|
||||
end
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
class LimitForbidControl::SendEmailCode < LimitForbidControl::Base
|
||||
attr_reader :email
|
||||
|
||||
def initialize(email)
|
||||
super()
|
||||
@email = email
|
||||
end
|
||||
|
||||
def allow_times
|
||||
EduSetting.get('daily_send_email_code_times').presence || 5
|
||||
end
|
||||
|
||||
def forbid_expires
|
||||
num = EduSetting.get('daily_send_email_code_forbid_time').presence.to_i
|
||||
num.zero? ? 10.minutes : num.to_i.hours
|
||||
end
|
||||
|
||||
def cumulative_expires
|
||||
1.hours
|
||||
end
|
||||
|
||||
def cache_key
|
||||
@_cache_key ||= "limit_forbid_control:#{day}:send_email_code:#{email}"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
class LimitForbidControl::UserLogin < LimitForbidControl::Base
|
||||
attr_reader :user
|
||||
|
||||
def initialize(user)
|
||||
super()
|
||||
@user = user
|
||||
end
|
||||
|
||||
def allow_times
|
||||
EduSetting.get('daily_error_password_times').presence || 5
|
||||
end
|
||||
|
||||
def forbid_expires
|
||||
num = EduSetting.get('daily_error_password_forbid_time').presence.to_i
|
||||
num.zero? ? 1.hours : num.to_i.minutes
|
||||
end
|
||||
|
||||
def cumulative_expires
|
||||
1.days
|
||||
end
|
||||
|
||||
def cache_key
|
||||
@_cache_key ||= "limit_forbid_control:#{day}:user_login:#{user.id}"
|
||||
end
|
||||
end
|
|
@ -1,60 +0,0 @@
|
|||
json.top do
|
||||
json.shixun_url "/shixuns"
|
||||
json.shixun_paths_url "/paths"
|
||||
json.course_url "/courses"
|
||||
json.competitions_url "#{@old_domain}/competitions"
|
||||
json.topic_url "/forums"
|
||||
json.new_course_url "/courses/new"
|
||||
json.new_shixun_url "/shixuns/new"
|
||||
json.new_shixun_path_url "/paths/new"
|
||||
json.new_project_url "#{@old_domain}/projects/new"
|
||||
json.join_course_url "/courses/join_course_multi_role"
|
||||
json.join_project_url "#{@old_domain}/applied_project/applied_project_info"
|
||||
json.message_url "#{@user_url}/user_tidings"
|
||||
json.new_message @new_message
|
||||
|
||||
json.moop_cases_url "#{@old_domain}/moop_cases"
|
||||
json.crowdsourcing_url "/crowdsourcing"
|
||||
|
||||
# 客户管理
|
||||
json.customer_management_url current_user.partner_managers.exists? ? "/partners/#{current_user.partner_managers.first.partner_id}/customers" : nil
|
||||
|
||||
json.career_url do
|
||||
json.array! @career.to_a do |c|
|
||||
if c[1].present?
|
||||
json.name c[1]
|
||||
json.url "#{@old_domain}/careers/#{c[0]}/introduction"
|
||||
end
|
||||
end
|
||||
end
|
||||
json.auth @auth
|
||||
|
||||
json.avatar_url "#{@user_url}"
|
||||
json.my_course_url "#{@user_url}"
|
||||
json.my_shixun_url "#{@user_url}?type=a_shixun"
|
||||
json.my_shixun_paths_url "#{@user_url}?type=a_path"
|
||||
json.my_project_url "#{@user_url}?type=a_project"
|
||||
json.account_manager_url "#{@old_domain}/my/account"
|
||||
json.logout_url logout_accounts_path
|
||||
json.college_identifier @user.college_identifier
|
||||
# 旧版的域名
|
||||
json.old_url @old_domain
|
||||
|
||||
# 云上实验室管理权限
|
||||
laboratory_user = current_laboratory.laboratory_users.exists?(user_id: @user&.id) || @user&.admin_or_business?
|
||||
json.laboratory_user laboratory_user
|
||||
json.laboratory_admin_url laboratory_user ? "/cooperative" : nil
|
||||
json.laboratory_user @user&.admin_or_business? || current_laboratory&.laboratory_users.exists?(user_id: @user&.id)
|
||||
end
|
||||
|
||||
json.down do
|
||||
json.web_root "#{@old_domain}"
|
||||
json.about_us "#{@old_domain}/help?index=1"
|
||||
json.connect_us "#{@old_domain}/help?index=2"
|
||||
json.cooperation_partner "#{@old_domain}/help?index=3"
|
||||
json.service_agreement "#{@old_domain}/help?index=4"
|
||||
json.help_center "#{@old_domain}/help?index=5"
|
||||
json.feedback "#{@old_domain}/help?index=6"
|
||||
end
|
||||
|
||||
json.online_consult "https://shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd"
|
|
@ -13,20 +13,3 @@ json.phone @user.phone
|
|||
json.email @user.mail
|
||||
json.profile_completed @user.profile_completed?
|
||||
json.professional_certification @user.professional_certification
|
||||
json.main_site current_laboratory.main_site?
|
||||
json.is_shixun_marker current_user.is_shixun_marker? || current_user.admin_or_business?
|
||||
if @course
|
||||
json.course_identity @course_identity
|
||||
json.course_name @course.name
|
||||
json.course_public @course.is_public
|
||||
json.course_excellent @course.excellent
|
||||
if params[:group_info]
|
||||
json.group_info @course.teacher_group(@user.id) if @course_identity < Course::STUDENT
|
||||
end
|
||||
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
|
||||
json.course_is_end @course.is_end
|
||||
end
|
||||
|
||||
if params[:school]
|
||||
json.user_school @user.school_name
|
||||
end
|
||||
|
|
268
db/structure.sql
268
db/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,7 @@
|
|||
"./static/js/164.c4629f51.chunk.js": "./static/js/164.c4629f51.chunk.js",
|
||||
"./static/js/165.218a5560.chunk.js": "./static/js/165.218a5560.chunk.js",
|
||||
"./static/js/166.68f61142.chunk.js": "./static/js/166.68f61142.chunk.js",
|
||||
"./static/js/167.f5226e09.chunk.js": "./static/js/167.f5226e09.chunk.js",
|
||||
"./static/js/167.a69d09f0.chunk.js": "./static/js/167.a69d09f0.chunk.js",
|
||||
"./static/js/168.bc78cd9b.chunk.js": "./static/js/168.bc78cd9b.chunk.js",
|
||||
"./static/js/169.76cc22e9.chunk.js": "./static/js/169.76cc22e9.chunk.js",
|
||||
"./static/js/17.a4471a8c.chunk.js": "./static/js/17.a4471a8c.chunk.js",
|
||||
|
@ -282,7 +282,7 @@
|
|||
"./static/js/98.4c2c8b49.chunk.js": "./static/js/98.4c2c8b49.chunk.js",
|
||||
"./static/js/99.4ecedbde.chunk.js": "./static/js/99.4ecedbde.chunk.js",
|
||||
"main.css": "./static/css/main.fd229636.css",
|
||||
"main.js": "./static/js/main.62f0e757.js",
|
||||
"main.js": "./static/js/main.d88d0e13.js",
|
||||
"static/media/KaTeX_AMS-Regular.ttf": "static/media/KaTeX_AMS-Regular.aaf4eee9.ttf",
|
||||
"static/media/KaTeX_AMS-Regular.woff": "static/media/KaTeX_AMS-Regular.7f06b4e3.woff",
|
||||
"static/media/KaTeX_AMS-Regular.woff2": "static/media/KaTeX_AMS-Regular.e78e28b4.woff2",
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
_host = 'https://ali-cdn.educoder.net/react/build/'
|
||||
}
|
||||
document.write('<script type="text/javascript" src="' + _host + 'js/js_min_all.js"><\/script>');
|
||||
document.write('<script type="text/javascript" src="' + _host + 'static/js/main.62f0e757.js"><\/script>');
|
||||
document.write('<script type="text/javascript" src="' + _host + 'static/js/main.d88d0e13.js"><\/script>');
|
||||
})()
|
||||
</script>
|
||||
<script>!function(){var t=location.href;"3007"===window.location.port?-1!=t.indexOf("/tasks/")?(document.write('<script type="text/javascript" src="https://newweb.educoder.net/assets/kindeditor/kindeditor.js"><\/script>'),document.write('<script type="text/javascript" src="/react/build/js/create_kindeditor.js?v=1.1.1"><\/script>'),document.write('<script type="text/javascript" src="https://newweb.educoder.net/javascripts/educoder/edu_application.js"><\/script>')):-1!=t.indexOf("/paths/")&&document.write('<script type="text/javascript" src="https://newweb.educoder.net/javascripts/educoder/edu_application.js"><\/script>'):-1!=t.indexOf("/tasks/")?(document.write('<script type="text/javascript" src="/assets/kindeditor/kindeditor.js"><\/script>'),document.write('<script type="text/javascript" src="/react/build/js/create_kindeditor.js?v=1.1.1"><\/script>'),document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>')):-1!=t.indexOf("/paths/")&&document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>')}()</script><script type="text/javascript" src="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -201,7 +201,7 @@ class Index extends Component{
|
|||
</div>:""
|
||||
)
|
||||
return(
|
||||
<div style={{background:"#fafafa",height:"100vh"}}>
|
||||
<div style={{background:"#fafafa"}}>
|
||||
<p className="t_project_banner"></p>
|
||||
<div className="main ProjectListIndex">
|
||||
<div className="list-left">
|
||||
|
|
|
@ -4,20 +4,9 @@ import { Link } from 'react-router-dom';
|
|||
|
||||
|
||||
class NewFooter extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps, newContext) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="newFooter edu-txt-center ">
|
||||
|
||||
<style>
|
||||
{
|
||||
`
|
||||
|
@ -33,47 +22,29 @@ class NewFooter extends Component {
|
|||
}
|
||||
</style>
|
||||
|
||||
{/*newContainers*/}
|
||||
<div className="inner-footer_con">
|
||||
{this.props.user&&this.props.user.main_site===true?<div className="footercon">
|
||||
{/* <div className="inline mt40 mb5">
|
||||
<a href="/" className="fl" style={{height:'70px'}}>
|
||||
<img alt="高校智能化教学与实训平台" src={getImageUrl(`images/educoder/headNavLogo.png?1526520218`)} width="70px">
|
||||
</img>
|
||||
</a>
|
||||
<span className="fl color-grey-c cdefault font-28 ml22" style={{lineHeight:'74px'}}>EduCoder.net</span>
|
||||
</div> */}
|
||||
<ul className="clearfix inner-footernav">
|
||||
<li><a href="/" className="fl" target="_blank">网站首页</a></li>
|
||||
<li><Link to="/help/about_us" className="fl" target="_blank">关于我们</Link></li>
|
||||
<li><Link to="/help/contact_us" className="fl" target="_blank">联系我们</Link></li>
|
||||
<li><Link to="/help/cooperatives" className="fl" target="_blank">合作伙伴</Link></li>
|
||||
<li><Link to="/help/agreement" className="fl" target="_blank">服务协议</Link></li>
|
||||
<li><Link to="/help/help_center" className="fl" target="_blank">帮助中心</Link></li>
|
||||
<li><Link to="/help/feedback" className="fl" target="_blank">意见反馈</Link></li>
|
||||
</ul>
|
||||
</div>:""}
|
||||
<div>
|
||||
{this.props.mygetHelmetapi === null ? "" :
|
||||
this.props.mygetHelmetapi===undefined|| this.props.mygetHelmetapi.footer===null||this.props.mygetHelmetapi.footer===undefined?
|
||||
<p className="footer_con-p inline lineh-30 font-14">
|
||||
<span className="font-18 fl">©</span> {moment().year()} EduCoder
|
||||
<a style={{"color":"#888"}} target="_blank" href="http://beian.miit.gov.cn/" className="ml15 mr15">湘ICP备17009477号</a>
|
||||
<a style={{"color":"#888"}} target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=43019002000962" className="mr15">
|
||||
<img className="vertical4" src={require('./beian.png')}/>湘公网安备43019002000962号
|
||||
</a>
|
||||
<a href="https://team.trustie.net" style={{"color":"#888"}}
|
||||
target="_blank">Trustie</a> & IntelliDE inside. <span
|
||||
className="mr15">版权所有 湖南智擎科技有限公司</span>
|
||||
</p>
|
||||
:
|
||||
<div dangerouslySetInnerHTML={{__html: this.props.mygetHelmetapi.footer}}></div>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
<div className="cl"></div>
|
||||
<ul className="clearfix inner-footernav">
|
||||
<li><a href="/" className="fl" target="_blank">网站首页</a></li>
|
||||
<li><Link to="/help/about_us" className="fl" target="_blank">关于我们</Link></li>
|
||||
<li><Link to="/help/contact_us" className="fl" target="_blank">联系我们</Link></li>
|
||||
<li><Link to="/help/cooperatives" className="fl" target="_blank">合作伙伴</Link></li>
|
||||
<li><Link to="/help/agreement" className="fl" target="_blank">服务协议</Link></li>
|
||||
<li><Link to="/help/help_center" className="fl" target="_blank">帮助中心</Link></li>
|
||||
<li><Link to="/help/feedback" className="fl" target="_blank">意见反馈</Link></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<p className="footer_con-p inline lineh-30 font-14">
|
||||
<span className="font-18 fl">©</span> {moment().year()} EduCoder
|
||||
<a style={{"color":"#888"}} target="_blank" href="http://beian.miit.gov.cn/" className="ml15 mr15">湘ICP备17009477号</a>
|
||||
<a style={{"color":"#888"}} target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=43019002000962" className="mr15">
|
||||
<img className="vertical4" src={require('./beian.png')}/>湘公网安备43019002000962号
|
||||
</a>
|
||||
<a href="https://team.trustie.net" style={{"color":"#888"}} target="_blank">Trustie</a> & IntelliDE inside. <span
|
||||
className="mr15">版权所有 湖南智擎科技有限公司</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="cl"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue