mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 13:56:43 +00:00
Add eslint rule and fix as many issues as possible
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { IUser } from '../models';
|
||||
import { createOrganization } from './organization';
|
||||
import { addMembershipsOrg } from './membershipOrg';
|
||||
import { OWNER, ACCEPTED } from '../variables';
|
||||
import { sendMail } from '../helpers/nodemailer';
|
||||
import { TokenService } from '../services';
|
||||
import { TOKEN_EMAIL_CONFIRMATION } from '../variables';
|
||||
import { IUser } from "../models";
|
||||
import { createOrganization } from "./organization";
|
||||
import { addMembershipsOrg } from "./membershipOrg";
|
||||
import { ACCEPTED, OWNER } from "../variables";
|
||||
import { sendMail } from "../helpers/nodemailer";
|
||||
import { TokenService } from "../services";
|
||||
import { TOKEN_EMAIL_CONFIRMATION } from "../variables";
|
||||
|
||||
/**
|
||||
* Send magic link to verify email to [email]
|
||||
@@ -16,17 +16,17 @@ import { TOKEN_EMAIL_CONFIRMATION } from '../variables';
|
||||
export const sendEmailVerification = async ({ email }: { email: string }) => {
|
||||
const token = await TokenService.createToken({
|
||||
type: TOKEN_EMAIL_CONFIRMATION,
|
||||
email
|
||||
email,
|
||||
});
|
||||
|
||||
// send mail
|
||||
await sendMail({
|
||||
template: 'emailVerification.handlebars',
|
||||
subjectLine: 'Infisical confirmation code',
|
||||
template: "emailVerification.handlebars",
|
||||
subjectLine: "Infisical confirmation code",
|
||||
recipients: [email],
|
||||
substitutions: {
|
||||
code: token
|
||||
}
|
||||
code: token,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export const sendEmailVerification = async ({ email }: { email: string }) => {
|
||||
*/
|
||||
export const checkEmailVerification = async ({
|
||||
email,
|
||||
code
|
||||
code,
|
||||
}: {
|
||||
email: string;
|
||||
code: string;
|
||||
@@ -46,7 +46,7 @@ export const checkEmailVerification = async ({
|
||||
await TokenService.validateToken({
|
||||
type: TOKEN_EMAIL_CONFIRMATION,
|
||||
email,
|
||||
token: code
|
||||
token: code,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ export const checkEmailVerification = async ({
|
||||
*/
|
||||
export const initializeDefaultOrg = async ({
|
||||
organizationName,
|
||||
user
|
||||
user,
|
||||
}: {
|
||||
organizationName: string;
|
||||
user: IUser;
|
||||
@@ -69,14 +69,14 @@ export const initializeDefaultOrg = async ({
|
||||
// subscription
|
||||
const organization = await createOrganization({
|
||||
email: user.email,
|
||||
name: organizationName
|
||||
name: organizationName,
|
||||
});
|
||||
|
||||
await addMembershipsOrg({
|
||||
userIds: [user._id.toString()],
|
||||
organizationId: organization._id.toString(),
|
||||
roles: [OWNER],
|
||||
statuses: [ACCEPTED]
|
||||
statuses: [ACCEPTED],
|
||||
});
|
||||
} catch (err) {
|
||||
throw new Error(`Failed to initialize default organization and workspace [err=${err}]`);
|
||||
|
||||
Reference in New Issue
Block a user