File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Request , Response } from "express" ;
2
2
import { config } from "../config" ;
3
3
import { createAndSaveToken , TokenType } from "../utils/tokenUtils" ;
4
-
4
+ import { getHashCache } from "../utils/getHashCache" ;
5
5
6
6
interface GenerateTokenRequest extends Request {
7
7
query : {
@@ -15,12 +15,13 @@ interface GenerateTokenRequest extends Request {
15
15
16
16
export async function generateTokenRequest ( req : GenerateTokenRequest , res : Response ) : Promise < Response > {
17
17
const { query : { code, adminUserID } , params : { type } } = req ;
18
+ const adminUserIDHash = await getHashCache ( adminUserID ) ;
18
19
19
20
if ( ! code || ! type ) {
20
21
return res . status ( 400 ) . send ( "Invalid request" ) ;
21
22
}
22
23
23
- if ( type === TokenType . patreon || ( type === TokenType . local && adminUserID === config . adminUserID ) ) {
24
+ if ( type === TokenType . patreon || ( type === TokenType . local && adminUserIDHash === config . adminUserID ) ) {
24
25
const licenseKey = await createAndSaveToken ( type , code ) ;
25
26
26
27
if ( licenseKey ) {
You can’t perform that action at this time.
0 commit comments