From 515d151455665d563638a23598afbe68053fd701 Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Tue, 14 May 2024 10:45:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=9A=E7=94=A8=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3=E7=9A=84email=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 ++- src/controllers/mail.controller.ts | 8 ++++++++ src/plats/PlatEmail.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.env.development b/.env.development index bc6eb09..50d2480 100644 --- a/.env.development +++ b/.env.development @@ -8,7 +8,8 @@ API_TOKEN_EXPIRESIN=1d GOOGLE_OAUTH_CLIENT="53206975661-asnf3qe4bg29p8h981pgf099osvrjbme.apps.googleusercontent.com" GOOGLE_OAUTH_CLIENT2="53206975661-ih3r0ubph3rqejdq97b029difbrk2bqj.apps.googleusercontent.com" GOOGLE_OAUTH_CLIENT_IOS="53206975661-qan0rnefniegjv53ohild375pv0p7ekd.apps.googleusercontent.com" -DB_MAIN=mongodb://188.88.0.2/wallet-development +# DB_MAIN=mongodb://188.88.0.2/wallet-development +DB_MAIN=mongodb://192.168.100.22/wallet-development EMAIL_VERIFY_URL="https://wallet.cebggame.com" EMAIL_SERVER='http://127.0.0.1:3087' diff --git a/src/controllers/mail.controller.ts b/src/controllers/mail.controller.ts index 6f8bd0d..5d7ac94 100644 --- a/src/controllers/mail.controller.ts +++ b/src/controllers/mail.controller.ts @@ -3,6 +3,8 @@ import logger from 'logger/logger' import { Account } from 'modules/Account' import { CodeRecord, CodeStatus, CodeType, DEFAULT_CODE, DEFAULT_EXPIRE_TIME } from 'modules/CodeRecord' import { + DEFAULT_LOGIN_MAIL_HTML, + DEFAULT_LOGIN_MAIL_SUBJECT, DEFAULT_REGIST_HTML, DEFAULT_REGIST_SUBJECT, DEFAULT_RESET_HTML, @@ -154,6 +156,12 @@ class MailController extends BaseController { case CodeType.VERIFY: html = DEFAULT_VERIFY_MAIL_HTML subject = DEFAULT_VERIFY_MAIL_SUBJECT + case CodeType.LOGIN: + html = DEFAULT_LOGIN_MAIL_HTML + subject = DEFAULT_LOGIN_MAIL_SUBJECT + } + if (!html || !subject) { + throw new ZError(15, 'type error') } subject = record.code + ' ' + subject diff --git a/src/plats/PlatEmail.ts b/src/plats/PlatEmail.ts index a04f55a..b946490 100644 --- a/src/plats/PlatEmail.ts +++ b/src/plats/PlatEmail.ts @@ -38,7 +38,7 @@ export class PlatEmail implements IPlat { throw new ZError(14, 'code error') } const openId = sha1(email) - let data: any = { email, emailVerified: true } + let data: any = { email, emailReal: email, emailVerified: true } const { api_platform } = req.headers if (api_platform) { data.platform = api_platform