fix: compute hash of the T&C text only
This commit is contained in:
parent
c5e7627afb
commit
028c8c3b13
1 changed files with 4 additions and 5 deletions
|
|
@ -30,19 +30,18 @@ const SECRET_FIELDS = [
|
||||||
* JSON.stringify isn't necessarily deterministic so this function may compute
|
* JSON.stringify isn't necessarily deterministic so this function may compute
|
||||||
* different hashes for the same object.
|
* different hashes for the same object.
|
||||||
*/
|
*/
|
||||||
const md5hash = obj =>
|
const md5hash = text =>
|
||||||
crypto
|
crypto
|
||||||
.createHash('MD5')
|
.createHash('MD5')
|
||||||
.update(JSON.stringify(obj))
|
.update(text)
|
||||||
.digest('hex')
|
.digest('hex')
|
||||||
|
|
||||||
const addTermsHash = configs => {
|
const addTermsHash = configs => {
|
||||||
configs = _.omit('termsConditions_hash', configs)
|
const terms = _.omit(['hash'], getTermsConditions(configs))
|
||||||
const terms = getTermsConditions(configs)
|
|
||||||
return _.isEmpty(terms) ?
|
return _.isEmpty(terms) ?
|
||||||
configs :
|
configs :
|
||||||
_.flow(
|
_.flow(
|
||||||
_.omit(['hash']),
|
_.get('text'),
|
||||||
md5hash,
|
md5hash,
|
||||||
hash => _.set('hash', hash, terms),
|
hash => _.set('hash', hash, terms),
|
||||||
setTermsConditions,
|
setTermsConditions,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue