From 062719adcea8a6c747958c6fc7890e7fd9758698 Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Tue, 6 May 2025 22:58:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84auth=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tone-page-server/src/auth/auth.service.ts | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tone-page-server/src/auth/auth.service.ts b/tone-page-server/src/auth/auth.service.ts index cb17924..0864e84 100644 --- a/tone-page-server/src/auth/auth.service.ts +++ b/tone-page-server/src/auth/auth.service.ts @@ -5,27 +5,33 @@ import { LoginDto } from './dto/login.dto'; export class AuthService { async loginWithPassword(loginDto: LoginDto) { const { account, password } = loginDto; - if (!account || !password) { - throw new BadRequestException('account and password are required'); - } + // 依次使用账号、手机号、邮箱登录 return { message: 'Logged in with password', data: loginDto }; } async loginWithPhone(loginDto: LoginDto) { const { phone, code } = loginDto; - if (!phone || !code) { - throw new BadRequestException('Phone number and code are required'); - } + // 先判断验证码是否正确 + + + // 判断用户是否存在,若不存在则进行注册 + + + // 登录,颁发token return { message: 'Logged in with phone', data: loginDto }; } async loginWithEmail(loginDto: LoginDto) { const { email, code } = loginDto; - if (!email || !code) { - throw new BadRequestException('Email and code are required'); - } + // 先判断验证码是否正确 + + + // 判断用户是否存在,若不存在则进行注册 + + + // 登录,颁发token return { message: 'Logged in with email', data: loginDto }; }