Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

issues25489
杨树明 6 years ago
commit 5b5338a5e4

@ -78,12 +78,12 @@ class AccountsController < ApplicationController
return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked?
login_control = LimitForbidControl::UserLogin.new(@user)
return normal_status(-2, "登录密码出错已达上限,将锁定密码#{login_control.forbid_expires/60}分钟") if login_control.forbid?
return normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回登录密码,") if login_control.forbid?
password_ok = @user.check_password?(params[:password].to_s)
unless password_ok
login_control.increment!
return normal_status(-2, "误的账号或密码")
return normal_status(-2, "你已经输错密码#{login_control.error_times}次,还剩余#{login_control.remain_times}次机会")
end
successful_authentication(@user)
@ -111,9 +111,11 @@ class AccountsController < ApplicationController
return normal_status(-2, "验证码已失效") if !verifi_code&.effective?
user.password, user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if user.save!
sucess_status
ActiveRecord::Base.transaction do
user.save!
LimitForbidControl::UserLogin.new(user).clear
end
sucess_status
rescue Exception => e
uid_logger_error(e.message)
tip_exception("密码重置失败")

@ -40,6 +40,14 @@ class LimitForbidControl::Base
end
end
def error_times
Rails.cache.read(cache_key).to_i
end
def remain_times
allow_times - error_times
end
def clear
Rails.logger.info("[LimitForbidControl] Clear #{cache_key}")
Rails.cache.delete(forbid_cache_key)

@ -146,7 +146,7 @@ class UseBank extends Component{
let url = `/question_banks/save_banks.json`
this.setState({ loading: true })
axios.post(url
,{
, {
"object_type": object_type,
"bank_id": checkBoxValues,
"course_id": courseId
@ -267,14 +267,14 @@ class UseBank extends Component{
></Search>
</div>
{
object_list && object_list.length == 0 && page == 1 ? "" : nav_my==='myself'?
object_list && object_list.length == 0 && page == 1 ? "" : nav_my === 'myself' ?
<p className="color-grey-6 mb25 edu-txt-center">选用对象你在课堂{engNameMap[object_type]}列表中已<span className="color-orange-tip">加入题库</span>{engNameMap[object_type]}</p>
:
<p className="color-grey-6 mb25 edu-txt-center">选用对象题库中已设置成公共属性的所有{engNameMap[object_type]}</p>
}
{
nav_my !='myself' && is_teacher == false ?
nav_my != 'myself' && is_teacher == false ?
<div style={{"height":"230px"}} className="d_middle edu-txt-center">
<div>
<p className="font-16 mb20 color-grey-3">通过职业认证的教师才能访问公共题库</p>
@ -313,7 +313,7 @@ class UseBank extends Component{
>{item.course_list_name}</span>
{
nav_my==='public' &&
nav_my === 'public' &&
<span className="fl with16 color-grey-6 task-hide pl10">{item.username}</span>
}
{nav_my === "myself" ?
@ -353,7 +353,7 @@ class UseBank extends Component{
</div>
}
<p style={{height:"20px",lineHeight:"20px;", marginTop: '4px'}}>
<p style={{height: "20px", lineHeight: "20px;", marginTop: '4px'}}>
{
isChecked !="" ? <span className="color-red">{isChecked}</span>:""
}

Loading…
Cancel
Save