mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 07:27:43 +00:00
migrated to standard request
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
|||||||
} from '../../helpers/signup';
|
} from '../../helpers/signup';
|
||||||
import { issueAuthTokens, validateProviderAuthToken } from '../../helpers/auth';
|
import { issueAuthTokens, validateProviderAuthToken } from '../../helpers/auth';
|
||||||
import { INVITED, ACCEPTED } from '../../variables';
|
import { INVITED, ACCEPTED } from '../../variables';
|
||||||
import request from '../../config/request';
|
import { standardRequest } from '../../config/request';
|
||||||
import { getLoopsApiKey, getHttpsEnabled, getJwtSignupSecret } from '../../config';
|
import { getLoopsApiKey, getHttpsEnabled, getJwtSignupSecret } from '../../config';
|
||||||
import { BadRequestError } from '../../utils/errors';
|
import { BadRequestError } from '../../utils/errors';
|
||||||
|
|
||||||
@@ -71,14 +71,14 @@ export const completeAccountSignup = async (req: Request, res: Response) => {
|
|||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const [ AUTH_TOKEN_TYPE, AUTH_TOKEN_VALUE ] = <[string, string]>req.headers['authorization']?.split(' ', 2) ?? [null, null]
|
const [AUTH_TOKEN_TYPE, AUTH_TOKEN_VALUE] = <[string, string]>req.headers['authorization']?.split(' ', 2) ?? [null, null]
|
||||||
if(AUTH_TOKEN_TYPE === null) {
|
if (AUTH_TOKEN_TYPE === null) {
|
||||||
throw BadRequestError({message: `Missing Authorization Header in the request header.`});
|
throw BadRequestError({ message: `Missing Authorization Header in the request header.` });
|
||||||
}
|
}
|
||||||
if(AUTH_TOKEN_TYPE.toLowerCase() !== 'bearer') {
|
if (AUTH_TOKEN_TYPE.toLowerCase() !== 'bearer') {
|
||||||
throw BadRequestError({message: `The provided authentication type '${AUTH_TOKEN_TYPE}' is not supported.`})
|
throw BadRequestError({ message: `The provided authentication type '${AUTH_TOKEN_TYPE}' is not supported.` })
|
||||||
}
|
}
|
||||||
if(AUTH_TOKEN_VALUE === null) {
|
if (AUTH_TOKEN_VALUE === null) {
|
||||||
throw BadRequestError({
|
throw BadRequestError({
|
||||||
message: 'Missing Authorization Body in the request header',
|
message: 'Missing Authorization Body in the request header',
|
||||||
})
|
})
|
||||||
@@ -141,7 +141,7 @@ export const completeAccountSignup = async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
// sending a welcome email to new users
|
// sending a welcome email to new users
|
||||||
if (await getLoopsApiKey()) {
|
if (await getLoopsApiKey()) {
|
||||||
await request.post("https://app.loops.so/api/v1/events/send", {
|
await standardRequest.post("https://app.loops.so/api/v1/events/send", {
|
||||||
"email": email,
|
"email": email,
|
||||||
"eventName": "Sign Up",
|
"eventName": "Sign Up",
|
||||||
"firstName": firstName,
|
"firstName": firstName,
|
||||||
|
|||||||
Reference in New Issue
Block a user