Commit 4eb766ab by zhanghaozhe

视频安全问题

parent c4fb1d65
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
} }
}, },
"lint-staged": { "lint-staged": {
"*.(js|css)": "prettier --write" "*.(js|css)": ["prettier --write", "git add ."]
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app", "extends": "react-app",
......
src/
\ No newline at end of file
...@@ -4,10 +4,6 @@ import { withRouter } from "react-router-dom" ...@@ -4,10 +4,6 @@ import { withRouter } from "react-router-dom"
import { browser, getParam } from "src/utils" import { browser, getParam } from "src/utils"
class HeaderBar extends Component { class HeaderBar extends Component {
constructor(props) {
super(props)
}
goBack = () => { goBack = () => {
const { state, hash } = this.props.location const { state, hash } = this.props.location
if (hash.includes("goback")) { if (hash.includes("goback")) {
......
...@@ -4,7 +4,7 @@ import classnames from "classnames" ...@@ -4,7 +4,7 @@ import classnames from "classnames"
import { HeaderBar, Tag } from "../../common" import { HeaderBar, Tag } from "../../common"
import OpenApp from "./OpenApp" import OpenApp from "./OpenApp"
import { http, htmlDecode } from "src/utils" import { http } from "src/utils"
import { Object } from "core-js" import { Object } from "core-js"
export default class Examination extends PureComponent { export default class Examination extends PureComponent {
......
...@@ -77,7 +77,7 @@ class ML extends Component { ...@@ -77,7 +77,7 @@ class ML extends Component {
}, },
function (res) { function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") { if (res.err_msg === "get_brand_wcpay_request:ok") {
Toast.info("支付成功", 2) Toast.info("支付成功", 2)
_this.intervalPayStatus = setInterval(function () { _this.intervalPayStatus = setInterval(function () {
http http
...@@ -157,7 +157,7 @@ class ML extends Component { ...@@ -157,7 +157,7 @@ class ML extends Component {
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.forEach((item) => {
cookie.set("token", item.token, { cookie.set("token", item.token, {
expires, expires,
path: "/", path: "/",
...@@ -198,7 +198,7 @@ class ML extends Component { ...@@ -198,7 +198,7 @@ class ML extends Component {
transformUser = (res) => { transformUser = (res) => {
let payload let payload
res.map((item, index) => { res.forEach((item, index) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
......
import React, { Component } from 'react' import React, { Component } from "react"
import './set-password.scss' import "./set-password.scss"
import { withFormik, Form, Field } from "formik" import { withFormik, Form, Field } from "formik"
import PasswordInput from '../common/passwordInput' import PasswordInput from "../common/passwordInput"
import Button from '../common/Button' import Button from "../common/Button"
import classnames from 'classnames' import classnames from "classnames"
import { compose } from 'redux' import { compose } from "redux"
import { HeaderBar } from "src/common" import { HeaderBar } from "src/common"
import { http } from "src/utils" import { http } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { encrypt } from "src/components/passport/encryption" import { encrypt } from "src/components/passport/encryption"
import { isEmpty } from "lodash" import { isEmpty } from "lodash"
import { connect } from "react-redux" import { connect } from "react-redux"
import { setCurrentUser } from 'src/store/userAction' import { setCurrentUser } from "src/store/userAction"
import jsCookie from 'js-cookie' import jsCookie from "js-cookie"
class SetPassword extends Component { class SetPassword extends Component {
toFrom = () => { toFrom = () => {
let historyUrl = window.localStorage.getItem('HistoryUrl') let historyUrl = window.localStorage.getItem("HistoryUrl")
const {history} = this.props const { history } = this.props
history.push(historyUrl) history.push(historyUrl)
} }
render() { render() {
let {values, errors, location} = this.props let { values, errors, location } = this.props
let {from} = location.state || {from: {pathname: '/'}} let { from } = location.state || { from: { pathname: "/" } }
return ( return (
<> <>
<HeaderBar arrow={true} title={'设置密码'}/> <HeaderBar arrow={true} title={"设置密码"} />
<div className={'set-password'}> <div className={"set-password"}>
<p className='title'>密码需要包含6-16位字母及数字</p> <p className="title">密码需要包含6-16位字母及数字</p>
<Form> <Form>
<Field <Field name="password">
name='password' {({ field }) => {
>
{({field}) => {
return ( return (
<PasswordInput <PasswordInput
autoComplete={'on'} autoComplete={"on"}
placeholder={'设置密码'} placeholder={"设置密码"}
onChange={this.handleChange} onChange={this.handleChange}
{...field} {...field}
/> />
) )
}} }}
</Field> </Field>
<Button className={'btn-active'} <Button
active={values.password && values.agreement && isEmpty(errors)}>完成</Button> className={"btn-active"}
<label htmlFor="agreement" className='user-agreement'> active={values.password && values.agreement && isEmpty(errors)}
<Field type='checkbox' >
name='agreement' 完成
id='agreement' </Button>
className={classnames([ <label htmlFor="agreement" className="user-agreement">
this.props.values.agreement ? 'iconfont iconRectangleCopy' : 'disagree' <Field
])} type="checkbox"
name="agreement"
id="agreement"
className={classnames([
this.props.values.agreement
? "iconfont iconRectangleCopy"
: "disagree",
])}
/> />
同意<span>《七月在线用户使用协议》</span> 同意<span>《七月在线用户使用协议》</span>
</label> </label>
</Form> </Form>
<div className="skip" <div
style={{display: from && from.pathname.includes('forgot-password') ? 'none' : 'block'}}> className="skip"
style={{
display:
from && from.pathname.includes("forgot-password")
? "none"
: "block",
}}
>
<span onClick={this.toFrom}>跳过</span> <span onClick={this.toFrom}>跳过</span>
</div> </div>
</div> </div>
...@@ -73,51 +82,54 @@ class SetPassword extends Component { ...@@ -73,51 +82,54 @@ class SetPassword extends Component {
const formikConfig = { const formikConfig = {
mapPropsToValues() { mapPropsToValues() {
return { return {
password: '', password: "",
agreement: true agreement: true,
} }
}, },
handleSubmit: (values, {props}) => { handleSubmit: (values, { props }) => {
const {location} = props const { location } = props
let from = location.state && location.state.records && location.state.records[location.state.records.length - 2] || {pathname: '/'} let from = (location.state &&
if (from.pathname.includes('forgot-password')) { location.state.records &&
location.state.records[location.state.records.length - 2]) || {
pathname: "/",
}
if (from.pathname.includes("forgot-password")) {
forgotPasswordReset(values, props) forgotPasswordReset(values, props)
} else { } else {
bindMobileSetPassword(values, props) bindMobileSetPassword(values, props)
} }
}, },
validateOnChange: false, validateOnChange: false,
validate: values => { validate: (values) => {
let errors = {} let errors = {}
const re = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/ const re = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/
if (!re.test(values.password)) { if (!re.test(values.password)) {
errors.password = '密码需要包含6-16位字母及数字' errors.password = "密码需要包含6-16位字母及数字"
Toast.info(errors.password, 2, null, false) Toast.info(errors.password, 2, null, false)
} }
if (!values.agreement) { if (!values.agreement) {
errors.agreement = '您须同意《七月在线用户使用协议》' errors.agreement = "您须同意《七月在线用户使用协议》"
Toast.info(errors.agreement, 2, null, false) Toast.info(errors.agreement, 2, null, false)
} }
return errors return errors
} },
} }
function forgotPasswordReset(values, props) { function forgotPasswordReset(values, props) {
let key = sessionStorage.getItem('r_type') === 'email' ? 'email' : 'tel' let key = sessionStorage.getItem("r_type") === "email" ? "email" : "tel"
let requestKey = key === 'email' ? 'email' : 'phone' let requestKey = key === "email" ? "email" : "phone"
http.post(`${API['passport-api']}/account/up_pass_by_${requestKey}`, { http
[requestKey]: sessionStorage.getItem(key), .post(`${API["passport-api"]}/account/up_pass_by_${requestKey}`, {
password: encrypt(values.password) [requestKey]: sessionStorage.getItem(key),
}) password: encrypt(values.password),
.then(res => { })
.then((res) => {
if (res.data.errno == 200) { if (res.data.errno == 200) {
Toast.info('密码设置成功') Toast.info("密码设置成功")
setTimeout(function () { setTimeout(function () {
props.history.replace('/passport/account-login') props.history.replace("/passport/account-login")
}, 1000) }, 1000)
} else { } else {
Toast.info(res.data.msg, 2, null, false) Toast.info(res.data.msg, 2, null, false)
...@@ -126,17 +138,20 @@ function forgotPasswordReset(values, props) { ...@@ -126,17 +138,20 @@ function forgotPasswordReset(values, props) {
} }
function bindMobileSetPassword(values, props) { function bindMobileSetPassword(values, props) {
let uid = jsCookie.get('uid') let uid = jsCookie.get("uid")
http.post(`${API['passport-api']}/bind_mobile/set_pwd_new`, { http
uid: props.user.data.uid || uid, .post(`${API["passport-api"]}/bind_mobile/set_pwd_new`, {
password: encrypt(values.password) uid: props.user.data.uid || uid,
}) password: encrypt(values.password),
.then(res => { })
.then((res) => {
if (res.data.errno == 200) { if (res.data.errno == 200) {
const {location, history} = props const { location, history } = props
Toast.info('密码设置成功') Toast.info("密码设置成功")
let from = location.state && location.state.from || {pathname: '/'} let from = (location.state && location.state.from) || { pathname: "/" }
let local_redirect_url = JSON.parse(window.localStorage.getItem('binding_redirect')) let local_redirect_url = JSON.parse(
window.localStorage.getItem("binding_redirect")
)
// setTimeout(function () { // setTimeout(function () {
// if (local_redirect_url) { // if (local_redirect_url) {
...@@ -147,10 +162,10 @@ function bindMobileSetPassword(values, props) { ...@@ -147,10 +162,10 @@ function bindMobileSetPassword(values, props) {
// } // }
// }, 1000) // }, 1000)
let HistoryUrl = window.localStorage.getItem('HistoryUrl') let HistoryUrl = window.localStorage.getItem("HistoryUrl")
setTimeout(()=> { setTimeout(() => {
if (HistoryUrl) { if (HistoryUrl) {
let historyUrl = window.localStorage.getItem('HistoryUrl') let historyUrl = window.localStorage.getItem("HistoryUrl")
props.history.push(historyUrl) props.history.push(historyUrl)
} else { } else {
history.replace(from.pathname) history.replace(from.pathname)
...@@ -163,9 +178,6 @@ function bindMobileSetPassword(values, props) { ...@@ -163,9 +178,6 @@ function bindMobileSetPassword(values, props) {
} }
export default compose( export default compose(
connect( connect((state) => ({ user: state.user }), { setCurrentUser }),
state => ({user: state.user}),
{setCurrentUser}
),
withFormik(formikConfig) withFormik(formikConfig)
)(SetPassword) )(SetPassword)
...@@ -4,9 +4,6 @@ import "./DrawDocument.scss" ...@@ -4,9 +4,6 @@ import "./DrawDocument.scss"
import OpenApp from "src/common/CallApp" import OpenApp from "src/common/CallApp"
export default class DrawDocument extends Component { export default class DrawDocument extends Component {
constructor(props) {
super(props)
}
render() { render() {
return ( return (
<div className={"drawDocument"}> <div className={"drawDocument"}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment