diff --git a/pages.json b/pages.json index 6563c187b1b9dd74c8aa786abf6d8bfdbd58e032..ac91f72487bc6e0bb749048772d0718e37da61fd 100644 --- a/pages.json +++ b/pages.json @@ -1,130 +1,154 @@ { - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "uni-app" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate", - "style": { - "navigationBarTitleText": "注销账号" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/userinfo/userinfo", - "style": { - "navigationBarTitleText": "个人资料" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile", - "style": { - "navigationBarTitleText": "绑定手机号码" - } - }, - // #ifndef MP-WEIXIN - { - "path": "uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage", - "style": { - "navigationBarTitleText": "" - } - }, - // #endif - { - "path": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/login/login-withpwd", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/login/login-smscode", - "style": { - "navigationBarTitleText": "手机验证码登录" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/register/register", - "style": { - "navigationBarTitleText": "注册" - } - }, - // #ifndef MP-WEIXIN - { - "path": "uni_modules/uni-id-pages/pages/register/register-admin", - "style": { - "navigationBarTitleText": "注册管理员账号", - "enablePullDownRefresh": false - } - }, - // #endif - { - "path": "uni_modules/uni-id-pages/pages/register/register-by-email", - "style": { - "navigationBarTitleText": "邮箱验证码注册" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/retrieve/retrieve", - "style": { - "navigationBarTitleText": "重置密码" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/retrieve/retrieve-by-email", - "style": { - "navigationBarTitleText": "通过邮箱重置密码" - } - }, - { - "path": "uni_modules/uni-id-pages/pages/common/webview/webview", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, { - "path": "uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd", - "style": { - "navigationBarTitleText": "修改密码", - "enablePullDownRefresh": false - } - },{ - "path": "uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd", - "style": { - "navigationBarTitleText": "设置密码", - "enablePullDownRefresh": false - } - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "uni-app", - "navigationBarBackgroundColor": "#FFF", - "backgroundColor": "#F8F8F8" - /* #ifdef H5 */ - ,"navigationStyle": "custom" - /* #endif */ - }, - "condition": { //模式配置,仅开发期间生效 - "current": 0, //当前激活的模式(list 的索引项) - "list": [{ - "name": "", //模式名称 - "path": "", //启动页面,必选 - "query": "" //启动参数,在页面的onLoad函数里面得到 - }] - }, - "uniIdRouter": { - "loginPage": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", - "needLogin": [ - "uni_modules/uni-id-pages/pages/userinfo/userinfo" - ], - "resToLogin": true - } + "pages": [ + //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "uni-app" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate", + "style": { + "navigationBarTitleText": "注销账号" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/userinfo", + "style": { + "navigationBarTitleText": "个人资料" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile", + "style": { + "navigationBarTitleText": "绑定手机号码" + } + }, + // #ifndef MP-WEIXIN + { + "path": "uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage", + "style": { + "navigationBarTitleText": "" + } + }, + // #endif + { + "path": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/login/login-withpwd", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/login/login-smscode", + "style": { + "navigationBarTitleText": "手机验证码登录" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/register/register", + "style": { + "navigationBarTitleText": "注册" + } + }, + // #ifndef MP-WEIXIN + { + "path": "uni_modules/uni-id-pages/pages/register/register-admin", + "style": { + "navigationBarTitleText": "注册管理员账号", + "enablePullDownRefresh": false + } + }, + // #endif + { + "path": "uni_modules/uni-id-pages/pages/register/register-by-email", + "style": { + "navigationBarTitleText": "邮箱验证码注册" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/retrieve/retrieve", + "style": { + "navigationBarTitleText": "重置密码" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/retrieve/retrieve-by-email", + "style": { + "navigationBarTitleText": "通过邮箱重置密码" + } + }, + { + "path": "uni_modules/uni-id-pages/pages/common/webview/webview", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd", + "style": { + "navigationBarTitleText": "修改密码", + "enablePullDownRefresh": false + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd", + "style": { + "navigationBarTitleText": "设置密码", + "enablePullDownRefresh": false + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify", + "style": { + "navigationBarTitleText": "实名认证", + "enablePullDownRefresh": false + } + }, + { + "path": "uni_modules/uni-id-pages/pages/userinfo/face-verify/face-verify", + "style": { + "navigationBarTitleText": "人脸识别验证", + "enablePullDownRefresh": false + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#FFF", + "backgroundColor": "#F8F8F8" + /* #ifdef H5 */, + "navigationStyle": "custom" + /* #endif */ + }, + "condition": { + //模式配置,仅开发期间生效 + "current": 0, + //当前激活的模式(list 的索引项) + "list": [ + { + "name": "", + //模式名称 + "path": "", + //启动页面,必选 + "query": "" + //启动参数,在页面的onLoad函数里面得到 + } + ] + }, + "uniIdRouter": { + "loginPage": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", + "needLogin": [ + "uni_modules/uni-id-pages/pages/userinfo/userinfo" + ], + "resToLogin": true + } } diff --git a/uni_modules/uni-id-pages/common/check-id-card.js b/uni_modules/uni-id-pages/common/check-id-card.js index c01ea18c9a27d1640e5bd124b6e337cb54e4f9f4..cba63f9afc4300d211dce131e95cc34907d31460 100644 --- a/uni_modules/uni-id-pages/common/check-id-card.js +++ b/uni_modules/uni-id-pages/common/check-id-card.js @@ -1,5 +1,5 @@ export default function checkIdCard (idCardNumber) { - if (!idCardNumber) return false + if (!idCardNumber || typeof idCardNumber !== 'string' || idCardNumber.length !== 18) return false const coefficient = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] const checkCode = [1, 0, 'x', 9, 8, 7, 6, 5, 4, 3, 2] @@ -11,4 +11,4 @@ export default function checkIdCard (idCardNumber) { } return checkCode[sum % 11].toString() === code.toLowerCase() -} \ No newline at end of file +} diff --git a/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue b/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue index 22da3982ecb573edb1cda495293b96b136e11a01..e73619ada4b4d68d6d33a73b0d90c26e169833bc 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue @@ -79,7 +79,11 @@ export default { return } - if (!/^[\u4e00-\u9fa5]+$/.test(this.realName)) { + if ( + typeof this.realName !== 'string' || + this.realName.length < 2 || + !/^[\u4e00-\u9fa5]{1,10}(·?[\u4e00-\u9fa5]{1,10}){0,5}$/.test(this.realName) + ) { uni.showToast({ title: "姓名只能是汉字", icon: "none" diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js index 333cb6e706160ddfd82b368fbf1f830b44f02c12..58d6a1ff1626bc529d2f95a85fc26df7e7a43106 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js @@ -195,7 +195,7 @@ function isMatchUserApp (userAppList, matchAppList) { } function checkIdCard (idCardNumber) { - if (!idCardNumber || typeof idCardNumber !== 'string') return false + if (!idCardNumber || typeof idCardNumber !== 'string' || idCardNumber.length !== 18) return false const coefficient = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] const checkCode = [1, 0, 'x', 9, 8, 7, 6, 5, 4, 3, 2] @@ -231,14 +231,11 @@ function dataDesensitization (value = '', options = {}) { return first + star + last } -function getCurrentDate () { - const date = new Date() - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - - return new Date(`${year}/${month}/${day}`) +function getCurrentDateTimestamp (date = Date.now(), targetTimezone = 8) { + const oneHour = 60 * 60 * 1000 + return parseInt((date + targetTimezone * oneHour) / (24 * oneHour)) * (24 * oneHour) - targetTimezone * oneHour } + module.exports = { getType, isValidString, @@ -259,5 +256,5 @@ module.exports = { checkIdCard, catchAwait, dataDesensitization, - getCurrentDate + getCurrentDateTimestamp } diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js index 1b4866cd955e0db0036e1ce1917d38e222633d26..02210248f2cd1f80b994035ced3926c56e1d52bc 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js @@ -1,8 +1,7 @@ const { userCollection, REAL_NAME_STATUS, frvLogsCollection, dbCmd } = require('../../common/constants') const { ERROR } = require('../../common/error') const { encryptData } = require('../../common/sensitive-aes-cipher') -const { getCurrentDate } = require('../../common/utils') - +const { getCurrentDateTimestamp } = require('../../common/utils') /** * 获取认证ID * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-frv-certify-id @@ -63,7 +62,7 @@ module.exports = async function (params) { // 用户发起了人脸识别但未刷脸并且 certifyId 还在有效期内就还可以用上次的 certifyId if (frvLogs.data.length) { const record = frvLogs.data[0] - if (realName === record.real_name && idCard === record.identity) { + if (record.certify_id) { return { certifyId: record.certify_id } @@ -72,7 +71,7 @@ module.exports = async function (params) { const userFrvLogs = await frvLogsCollection.where({ user_id: uid, - created_date: dbCmd.gt(getCurrentDate().getTime()) + created_date: dbCmd.gt(getCurrentDateTimestamp()) }).get() // 限制用户每日认证次数