Skip to content

Commit f516f90

Browse files
fix: make telegram plugins routes unique
1 parent 30997a0 commit f516f90

File tree

1 file changed

+4
-4
lines changed
  • backend/src/auth/plugins/telegram

1 file changed

+4
-4
lines changed

backend/src/auth/plugins/telegram/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const telegramPlugin = () => {
3333
},
3434
endpoints: {
3535
startLink: createAuthEndpoint(
36-
"/telegram/link",
36+
"/telegram/link/start",
3737
{
3838
method: "POST",
3939
},
@@ -70,7 +70,7 @@ export const telegramPlugin = () => {
7070
},
7171
),
7272
verifyLink: createAuthEndpoint(
73-
"/telegram/link/:code",
73+
"/telegram/link/verify/:code",
7474
{
7575
method: "GET",
7676
},
@@ -81,8 +81,8 @@ export const telegramPlugin = () => {
8181
message: "You must be authenticated",
8282
});
8383

84-
const code = ctx.params.code;
85-
if (code.length !== CODE_LENGTH || /^\d+$/.test(code))
84+
const code = ctx.params?.code;
85+
if (!code || code.length !== CODE_LENGTH || /^\d+$/.test(code))
8686
return ctx.error("BAD_REQUEST", {
8787
message: "The code must be a 6-digit string",
8888
});

0 commit comments

Comments
 (0)