Commit 45167fe0 by lixinming

no message

parent 926b2512
<config>
<port>30001</port>
<port>7077</port>
<mongodb>
<path>127.0.0.1</path>
<port>27017</port>
......
......@@ -15,8 +15,7 @@ import { getPwdMd5 } from "../../util/tools";
* @param pwd 密码
* @returns fuhuaqiUserInfo:{uscc, name} 登录后的信息
*/
export async function login(uscc:string, pwd:string):Promise<object> {
if (typeof uscc != "string" || typeof pwd != "string") throw new BizError(ERRORENUM.参数错误, uscc, pwd);
export async function login(uscc:string, pwd:string) {
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUscc(uscc);
if(!fuhuaqiInfo) throw new BizError(ERRORENUM.未找到数据);
......@@ -30,6 +29,25 @@ export async function login(uscc:string, pwd:string):Promise<object> {
return fuhuaqiUserInfo;
}
/**
* 首次登录修改密码
* @param uscc 孵化器统一信用代码
* @param pwd 新密码p
* @param confirmPwd 确认密码
* @returns
*/
export async function firstLoginChangePwd(uscc:string, pwd:string, confirmPwd:string ) {
let dataBaseInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
if (dataBaseInfo.firstLoginIsChangePwd) throw new BizError(ERRORENUM.不能重复修改密码, `重复调用了首次登录之后的修改密码接口${uscc}`);
//todo 校验密码
dataBaseInfo.pwd = pwd;
await dataBaseInfo.save();
return {isSuccess:true};
}
/**
* 重置密码
* @param uscc 信用代码
......@@ -38,7 +56,6 @@ export async function login(uscc:string, pwd:string):Promise<object> {
* @returns {isSuccess:true/false}
*/
export async function changePassword(uscc:string, pwd:string, newPwd:string) {
if (typeof uscc != "string" || typeof pwd != "string" || typeof newPwd != "string") throw new BizError(ERRORENUM.参数错误, uscc, pwd, newPwd);
let reg = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
if (reg.test(newPwd)) {
throw new BizError(ERRORENUM.密码不允许有特殊字符);
......
......@@ -10,7 +10,8 @@ export enum ERRORENUM {
该企业当月数据已存在,
该报表需要填写本月内容后提交,
密码错误,
密码不允许有特殊字符
密码不允许有特殊字符,
不能重复修改密码
}
export enum ERRORCODEENUM {
......
......@@ -2,6 +2,7 @@
* 孵化器信息表
* operationName不可修改 2023-02-06 确定此需求
* uscc不可修改 2023-02-06 确定此需求
* 首次登录要求改密码 不改密码不能继续操作 2023-02-07 确定此需求
*/
import {Schema} from 'mongoose';
......@@ -10,6 +11,7 @@ import { baseDB } from '../../db/dbInit';
const fuHuaQiSchema = new Schema({
name: {type:String,index: true},//名称
pwd:String,//登录密码
firstLoginIsChangePwd:{type:Boolean, default:false},//首次登录是否修改密码
operationName:String,//运营机构名称 不可修改
uscc:{type:String, index: true},//统一信用代码 也是登录账号 不可修改
virtualEnterpriseNum:Number,//虚拟企业数量
......
......@@ -8,13 +8,13 @@ var baseDB;
export async function initDB() {
//如果配置了mongoServerConstVal 才会连接mongo
if (systemConfig.mongodbStr) {
console.log(systemConfig.mongodbStr)
console.log(systemConfig.mongodbStr, ' 连接成功')
baseDB = await createDbConnect(systemConfig.mongodbStr).catch(err => {
throw err
});
await initTable();
console.log('init mongodb success');
console.log('mongodb init success');
} else {
throw new BizError("xml中未配置mongo连接字符串 无法连接到mongodb");
}
......
......@@ -8,11 +8,6 @@ async function lanuch() {
await initDB();
httpServer.createServer(systemConfig.port);
console.log('This indicates that the server is started successfully.');
// await t();
}
async function t() {
await fuHuaQiTaskList('111');
}
lanuch();
\ No newline at end of file
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