feat: 手机号登录、邮箱验证码注册

This commit is contained in:
xiaojunnuo
2024-11-29 19:00:05 +08:00
parent 87bbf6f140
commit 7b55337c5e
55 changed files with 2150 additions and 337 deletions

View File

@@ -88,7 +88,7 @@ export class CodeService {
/**
*/
async sendEmailCode(email: string, randomStr: string) {
console.assert(!email, '手机号不能为空');
console.assert(!email, 'Email不能为空');
console.assert(!randomStr, 'randomStr不能为空');
const code = randomNumber(4);
@@ -98,7 +98,7 @@ export class CodeService {
receivers: [email],
});
const key = this.buildEmailCodeKey(email, code);
const key = this.buildEmailCodeKey(email, randomStr);
cache.set(key, code, {
ttl: 5 * 60 * 1000, //5分钟
});