mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
fix email env
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { OAuth2Client } from 'google-auth-library';
|
||||
import { createUserJwt } from '~/server/AuthManager';
|
||||
import { UserModel } from '@schema/UserSchema';
|
||||
import { sendWelcomeEmail } from '@services/EmailService';
|
||||
import EmailService from '@services/EmailService';
|
||||
|
||||
const { GOOGLE_AUTH_CLIENT_SECRET, GOOGLE_AUTH_CLIENT_ID } = useRuntimeConfig()
|
||||
|
||||
@@ -47,7 +47,7 @@ export default defineEventHandler(async event => {
|
||||
const savedUser = await newUser.save();
|
||||
|
||||
setImmediate(() => {
|
||||
if (payload.email) sendWelcomeEmail(payload.email);
|
||||
if (payload.email) EmailService.sendWelcomeEmail(payload.email);
|
||||
});
|
||||
|
||||
return { error: false, access_token: createUserJwt({ email: savedUser.email, name: savedUser.name }) }
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import mongoose from "mongoose";
|
||||
import { Redis } from "~/server/services/CacheService";
|
||||
import EmailService from '@services/EmailService';
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
let connection: mongoose.Mongoose;
|
||||
|
||||
@@ -7,8 +9,16 @@ export default async () => {
|
||||
|
||||
console.log('[SERVER] Initializing');
|
||||
|
||||
EmailService.createTransport(
|
||||
config.EMAIL_SERVICE,
|
||||
config.EMAIL_HOST,
|
||||
config.EMAIL_USER,
|
||||
config.EMAIL_PASS,
|
||||
);
|
||||
|
||||
|
||||
if (!connection || connection.connection.readyState == mongoose.ConnectionStates.disconnected) {
|
||||
console.log('[DATABASE] Connecting');
|
||||
console.log('[DATABASE] Connecting');
|
||||
connection = await mongoose.connect(config.MONGO_CONNECTION_STRING);
|
||||
console.log('[DATABASE] Connected');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user