Commit 4eb766ab by zhanghaozhe

视频安全问题

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