diff --git a/app/libs/util.rb b/app/libs/util.rb index 6c7784606..f39ce2b58 100644 --- a/app/libs/util.rb +++ b/app/libs/util.rb @@ -42,4 +42,13 @@ module Util return '' if str.blank? str.gsub(/<\/?.*?>/, '').gsub(/[\n\t\r]/, '').gsub(/ /, '') end + + def conceal(str, type = nil) + str = str.to_s + case type + when :phone then "#{str[0..2]}***#{str[-4..-1]}" + when :email then "#{str[0..2]}***#{str[str.rindex('@')..-1]}" + else "#{str[0..2]}***#{str[-3..-1]}" + end + end end \ No newline at end of file diff --git a/app/services/users/bind_email_service.rb b/app/services/users/bind_email_service.rb index 4c8124ffa..ed1c46404 100644 --- a/app/services/users/bind_email_service.rb +++ b/app/services/users/bind_email_service.rb @@ -11,7 +11,7 @@ class Users::BindEmailService < ApplicationService def call Users::BindEmailForm.new(params).validate! - raise Error, '该邮箱已被绑定' if User.where.not(id: user.id).exists?(mail: params[:email]) + raise Error, '该邮箱已被其他账号绑定' if User.where.not(id: user.id).exists?(mail: params[:email]) code = VerificationCode.where(email: params[:email], code: params[:code], code_type: 5).last raise Error, '验证码无效' unless code&.effective? diff --git a/app/services/users/bind_phone_service.rb b/app/services/users/bind_phone_service.rb index af4292230..2294e4b3c 100644 --- a/app/services/users/bind_phone_service.rb +++ b/app/services/users/bind_phone_service.rb @@ -11,7 +11,7 @@ class Users::BindPhoneService < ApplicationService def call Users::BindPhoneForm.new(params).validate! - raise Error, '该手机号已被绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) + raise Error, '该手机号已被其他账号绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 4).last raise Error, '验证码无效' unless code&.effective? diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index 1a910f224..fc2100694 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -1,4 +1,5 @@ const isDev = window.location.port == 3007; +export const TEST_HOST = "http://47.96.87.25:48080" export function getImageUrl(path) { // https://www.educoder.net // https://testbdweb.trustie.net diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index ae690e8ae..6f3284db2 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -4,7 +4,7 @@ import { from } from '_array-flatten@2.1.2@array-flatten'; export { getImageUrl as getImageUrl, getUrl as getUrl, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth - , getTaskUrlById as getTaskUrlById } from './UrlTool'; + , getTaskUrlById as getTaskUrlById, TEST_HOST } from './UrlTool'; export { default as queryString } from './UrlTool2'; export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC'; diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 006c0af49..724f8bc11 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -539,6 +539,8 @@ pop_box_new(htmlvalue, 480, 182); .then((response) => { // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."} + window.__fetchAllFlag = false; + if (response.data.status == 403) { window.location.href = "/403"; return; diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 0211b3801..33257703d 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -298,6 +298,7 @@ class MainContentContainer extends Component { }).then((fetchRepositoryCodeResponse) => { // monaca 需要刷新,不然无法编辑 if (this.retryAndRefresh && fetchRepositoryCodeResponse.data.content) { + this.retryAndRefresh = false; window.location.reload() return; } diff --git a/public/react/src/modules/page/main/Webssh.js b/public/react/src/modules/page/main/Webssh.js index ef38ccba9..51119a056 100644 --- a/public/react/src/modules/page/main/Webssh.js +++ b/public/react/src/modules/page/main/Webssh.js @@ -1,11 +1,11 @@ import React, { Component } from 'react'; - +import { TEST_HOST } from 'educoder' export function loadSshScript(callback) { let _url_origin = ``; let prefix = 'react/build' if (window.location.port == 3007) { - prefix = '' - _url_origin = 'https://newweb.educoder.net/'; + // prefix = '' + _url_origin = TEST_HOST + '/' // 'https://newweb.educoder.net/'; } else { // _url_origin = `https://testeduplus2.educoder.net/`; _url_origin = '/';