From 5b9e06200ef179f997e8560295b08893a23591a9 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Wed, 24 Jan 2024 18:04:43 +0300 Subject: [PATCH 1/6] email-verify&login-otp-first-attempt --- server/api/controllers/user.js | 8 ++++++-- server/api/swagger/common.yaml | 3 +++ server/messages.js | 1 + web/src/containers/VerificationEmailCode/index.js | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/api/controllers/user.js b/server/api/controllers/user.js index 04008dc13b..0add639004 100644 --- a/server/api/controllers/user.js +++ b/server/api/controllers/user.js @@ -27,6 +27,7 @@ const { LOGIN_NOT_ALLOW, NO_IP_FOUND, INVALID_OTP_CODE, + OTP_CODE_NOT_FOUND } = require('../../messages'); const { DEFAULT_ORDER_RISK_PERCENTAGE, EVENTS_CHANNEL, API_HOST, DOMAIN, TOKEN_TIME_NORMAL, TOKEN_TIME_LONG, HOLLAEX_NETWORK_BASE_URL, NUMBER_OF_ALLOWED_ATTEMPTS } = require('../../constants'); const { all } = require('bluebird'); @@ -155,10 +156,10 @@ const getVerifyUser = (req, res) => { }; const verifyUser = (req, res) => { - const { verification_code } = req.swagger.params.data.value; + const { verification_code, email } = req.swagger.params.data.value; const domain = req.headers['x-real-origin']; - toolsLib.user.verifyUser(null, verification_code, domain) + toolsLib.user.verifyUser(email, verification_code, domain) .then(() => { return res.json({ message: USER_VERIFIED }); }) @@ -299,6 +300,9 @@ const loginPost = (req, res) => { return toolsLib.security.checkCaptcha(captcha, ip); }) .catch(async (err) => { + if (!otp_code) { + throw new Error(OTP_CODE_NOT_FOUND); + } await toolsLib.user.createUserLogin(user, ip, device, domain, origin, referer, null, long_term, false); const loginData = await toolsLib.user.findUserLatestLogin(user, false); const message = createAttemptMessage(loginData, user, domain); diff --git a/server/api/swagger/common.yaml b/server/api/swagger/common.yaml index 4c33a53e6a..32395b66a7 100644 --- a/server/api/swagger/common.yaml +++ b/server/api/swagger/common.yaml @@ -187,6 +187,9 @@ paths: verification_code: type: string maxLength: 256 + email: + type: string + maxLength: 256 responses: 200: description: Success diff --git a/server/messages.js b/server/messages.js index 2e9d238bc3..3b477cc41d 100644 --- a/server/messages.js +++ b/server/messages.js @@ -44,6 +44,7 @@ exports.TOKEN_REVOKED = 'Token is already revoked'; exports.TOKEN_REMOVED = 'Token is successfully revoked'; exports.TOKEN_OTP_ENABLED = 'OTP must be enabled to create a token'; exports.INVALID_OTP_CODE = 'Invalid OTP Code'; +exports.OTP_CODE_NOT_FOUND = 'OTP not found'; exports.WALLET_ERROR_500 = 'Internal error. Withdrawal failed. Please try again in few minutes.'; diff --git a/web/src/containers/VerificationEmailCode/index.js b/web/src/containers/VerificationEmailCode/index.js index db39c4244f..329c55bd60 100644 --- a/web/src/containers/VerificationEmailCode/index.js +++ b/web/src/containers/VerificationEmailCode/index.js @@ -117,7 +117,8 @@ class VerifyEmailCode extends Component { onClick={async () => { this.setState({ confirm: true }); const { code } = this.props.params; - this.props.verifyCode({ verification_code: code }); + const { email } = this.props.location.query; + this.props.verifyCode({ verification_code: code, email }); }} style={{ backgroundColor: '#5D63FF', From d8a7fe6279da89f4876d433434a4951984c600d6 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Wed, 24 Jan 2024 18:05:04 +0300 Subject: [PATCH 2/6] email-verify&login-otp-first-attempt --- server/mail/templates/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/mail/templates/index.js b/server/mail/templates/index.js index 8259b85346..f40af8097d 100644 --- a/server/mail/templates/index.js +++ b/server/mail/templates/index.js @@ -87,7 +87,7 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => { else if (type === MAILTYPE.SIGNUP) { // ok html = html.replace(/\$\{name\}/g, email); html = html.replace(/\$\{api_name\}/g, API_NAME()); - html = html.replace(/\$\{link\}/g, `${domain}/verify/${data}`); + html = html.replace(/\$\{link\}/g, `${domain}/verify/${data}?email=${email}`); } else if (type === MAILTYPE.WELCOME) { //ok html = html.replace(/\$\{name\}/g, email || ''); From 949ee4d85a7239bbf15b9a26e4406e69286b7a68 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Tue, 23 Jan 2024 10:28:30 +0300 Subject: [PATCH 3/6] is_valid_currency_search_enable --- server/api/swagger/admin.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/server/api/swagger/admin.yaml b/server/api/swagger/admin.yaml index a68fd5e4be..a2f47ec562 100644 --- a/server/api/swagger/admin.yaml +++ b/server/api/swagger/admin.yaml @@ -2955,7 +2955,6 @@ paths: description: specify whether or not wallet is wallet required: false type: boolean - default: true - in: query name: network description: Blockchain network of wallet From d7ce7ce6bf89a6693cfb026c9e7c76319324156a Mon Sep 17 00:00:00 2001 From: fetok12 Date: Tue, 23 Jan 2024 09:43:48 +0300 Subject: [PATCH 4/6] is_valid_currency_search_enable --- .../Admin/AdminFinancials/TableFilter.js | 18 ++++++++++++++++-- .../containers/Admin/AdminFinancials/Wallet.js | 12 ++++++++++++ web/src/containers/Admin/Transfers/index.js | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/web/src/containers/Admin/AdminFinancials/TableFilter.js b/web/src/containers/Admin/AdminFinancials/TableFilter.js index aa2fdf5365..fe5ce7e3be 100644 --- a/web/src/containers/Admin/AdminFinancials/TableFilter.js +++ b/web/src/containers/Admin/AdminFinancials/TableFilter.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { connect } from 'react-redux'; -import { DatePicker, Input, Select, Button } from 'antd'; +import { DatePicker, Input, Select, Button, Checkbox } from 'antd'; import { SearchOutlined } from '@ant-design/icons'; import moment from 'moment'; @@ -68,6 +68,10 @@ const FieldComponent = ({ onHandleFieldChange({ currency: value.toLowerCase() }); }; + const onHandleCheck = (value) => { + onHandleFieldChange({ is_valid: value.target.checked }); + }; + const handleField = (handleRemove, value) => { switch (type) { case 'select': @@ -88,6 +92,16 @@ const FieldComponent = ({ onChange={onHandle} /> ); + case 'boolean': + return ( + + Valid Address + + ); case 'time-picker': return ( Date: Tue, 23 Jan 2024 10:02:31 +0300 Subject: [PATCH 5/6] is_valid_currency_search_enable --- web/src/containers/Admin/AdminFinancials/TableFilter.js | 7 ++++--- web/src/containers/Admin/AdminFinancials/Wallet.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/web/src/containers/Admin/AdminFinancials/TableFilter.js b/web/src/containers/Admin/AdminFinancials/TableFilter.js index fe5ce7e3be..889bf0d491 100644 --- a/web/src/containers/Admin/AdminFinancials/TableFilter.js +++ b/web/src/containers/Admin/AdminFinancials/TableFilter.js @@ -96,7 +96,7 @@ const FieldComponent = ({ return ( Valid Address @@ -167,7 +167,8 @@ const MultiFilter = ({ data.value = data.name; }); tempfield.forEach((data) => { - data.value = ''; + if (data.name === 'is_valid') data.value = true; + else data.value = ''; }); setOptions([...tempOptions]); setFieldsData([...fieldsData, ...tempfield]); @@ -216,7 +217,7 @@ const MultiFilter = ({ item?.value === '' || (item?.value?.start_date === '' && item?.value?.end_date === '') ); - if (updatedFieldsData.length === emptyFields.length && key !== 'is_valid') { + if (updatedFieldsData.length === emptyFields.length) { onHandle(); } setFieldsData([...updatedFieldsData]); diff --git a/web/src/containers/Admin/AdminFinancials/Wallet.js b/web/src/containers/Admin/AdminFinancials/Wallet.js index c84b91a00f..7ac80b7c61 100644 --- a/web/src/containers/Admin/AdminFinancials/Wallet.js +++ b/web/src/containers/Admin/AdminFinancials/Wallet.js @@ -70,7 +70,7 @@ const filterFields = [ value: true, placeholder: 'Valid', type: 'boolean', - name: 'valid', + name: 'is_valid', }, { label: 'Time', @@ -104,8 +104,8 @@ const filterOptions = [ }, { label: 'Valid', - value: 'valid', - name: 'valid', + value: 'is_valid', + name: 'is_valid', }, { label: 'Time', From a95bcf4056ae537dbfce87d21800b5fed7e868ba Mon Sep 17 00:00:00 2001 From: Ali Beikverdi Date: Fri, 26 Jan 2024 17:01:04 +0900 Subject: [PATCH 6/6] version update --- server/api/swagger/swagger.js | 2 +- server/package.json | 2 +- version | 2 +- web/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/api/swagger/swagger.js b/server/api/swagger/swagger.js index be45d267d2..cdd0501598 100644 --- a/server/api/swagger/swagger.js +++ b/server/api/swagger/swagger.js @@ -4,7 +4,7 @@ const definition = { swagger: '2.0', info: { title: 'HollaEx Kit', - version: '2.9.3' + version: '2.9.4' }, host: 'api.hollaex.com', basePath: '/v2', diff --git a/server/package.json b/server/package.json index eca42c9d79..21ed3a591e 100644 --- a/server/package.json +++ b/server/package.json @@ -1,5 +1,5 @@ { - "version": "2.9.3", + "version": "2.9.4", "private": false, "description": "HollaEx Kit", "keywords": [ diff --git a/version b/version index eafef0d4c5..d38c63d7e8 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.9.3 \ No newline at end of file +2.9.4 \ No newline at end of file diff --git a/web/package.json b/web/package.json index 28c5f6c4ef..e407666f85 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "hollaex-kit", - "version": "2.9.3", + "version": "2.9.4", "private": true, "dependencies": { "@ant-design/compatible": "1.0.5",