feat: 支持按品牌配置微信登录凭据
This commit is contained in:
1 parent
e75c524343
commit
d0a0eeea8c
23 files changed
+460
-62
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { Body, Controller, Get, Post, Query, Req, Res } from "@nestjs/common";
|
||||
import type { FastifyReply, FastifyRequest } from "fastify";
|
||||
import { WechatAuthService } from "../../wechat-auth.js";
|
||||
import { AdminPublic, AdminTokenOnly } from "../../admin-auth.decorators.js";
|
||||
import { clearAdminSessionCookie, setAdminSessionCookie } from "../../admin-session-cookie.js";
|
||||
import { AdminAuthService } from "../../admin-auth.service.js";
|
||||
@@ -11,18 +10,14 @@ import { ChangeAdminPasswordDto } from "../../admin.dto.js";
|
||||
|
||||
@Controller("customer/session")
|
||||
export class CustomerSessionController {
|
||||
constructor(
|
||||
private readonly wechatAuth: WechatAuthService,
|
||||
private readonly sessions: CustomerSessionService,
|
||||
) {}
|
||||
constructor(private readonly sessions: CustomerSessionService) {}
|
||||
|
||||
@Post("wechat")
|
||||
async wechatLogin(
|
||||
@Body() body: WechatLoginDto,
|
||||
@Query("brandSlug") brandSlug?: string,
|
||||
): Promise<{ token: string }> {
|
||||
const session = await this.wechatAuth.exchangeCode(body.code);
|
||||
return this.sessions.loginWithWechat(session, brandSlug);
|
||||
return this.sessions.loginWithWechat(body.code, brandSlug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user