mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
refactoring dashboard
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { createUserJwt, readRegisterJwt } from '~/server/AuthManager';
|
||||
import { UserModel } from '@schema/UserSchema';
|
||||
import { PasswordModel } from '@schema/PasswordSchema';
|
||||
import EmailService from '@services/EmailService';
|
||||
// import EmailService from '@services/EmailService';
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
@@ -14,7 +14,7 @@ export default defineEventHandler(async event => {
|
||||
try {
|
||||
await PasswordModel.create({ email: data.email, password: data.password })
|
||||
await UserModel.create({ email: data.email, given_name: '', name: 'EmailLogin', locale: '', picture: '', created_at: Date.now() });
|
||||
setImmediate(() => { EmailService.sendWelcomeEmail(data.email); });
|
||||
// setImmediate(() => { EmailService.sendWelcomeEmail(data.email); });
|
||||
const jwt = createUserJwt({ email: data.email, name: 'EmailLogin' });
|
||||
return sendRedirect(event,`https://dashboard.litlyx.com/jwt_login?jwt_login=${jwt}`);
|
||||
} catch (ex) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { OAuth2Client } from 'google-auth-library';
|
||||
import { createUserJwt } from '~/server/AuthManager';
|
||||
import { UserModel } from '@schema/UserSchema';
|
||||
import EmailService from '@services/EmailService';
|
||||
// import EmailService from '@services/EmailService';
|
||||
|
||||
const { GOOGLE_AUTH_CLIENT_SECRET, GOOGLE_AUTH_CLIENT_ID } = useRuntimeConfig()
|
||||
|
||||
@@ -58,10 +58,10 @@ export default defineEventHandler(async event => {
|
||||
|
||||
const savedUser = await newUser.save();
|
||||
|
||||
setImmediate(() => {
|
||||
console.log('SENDING WELCOME EMAIL TO', payload.email);
|
||||
if (payload.email) EmailService.sendWelcomeEmail(payload.email);
|
||||
});
|
||||
// setImmediate(() => {
|
||||
// console.log('SENDING WELCOME EMAIL TO', payload.email);
|
||||
// if (payload.email) EmailService.sendWelcomeEmail(payload.email);
|
||||
// });
|
||||
|
||||
return { error: false, access_token: createUserJwt({ email: savedUser.email, name: savedUser.name }) }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { createRegisterJwt, createUserJwt } from '~/server/AuthManager';
|
||||
import { UserModel } from '@schema/UserSchema';
|
||||
import { RegisterModel } from '@schema/RegisterSchema';
|
||||
import EmailService from '@services/EmailService';
|
||||
// import EmailService from '@services/EmailService';
|
||||
import crypto from 'crypto';
|
||||
|
||||
function canRegister(email: string, password: string) {
|
||||
@@ -33,9 +33,9 @@ export default defineEventHandler(async event => {
|
||||
|
||||
await RegisterModel.create({ email, password: hashedPassword });
|
||||
|
||||
setImmediate(() => {
|
||||
EmailService.sendConfirmEmail(email, `https://dashboard.litlyx.com/api/auth/confirm_email?register_code=${jwt}`);
|
||||
});
|
||||
// setImmediate(() => {
|
||||
// EmailService.sendConfirmEmail(email, `https://dashboard.litlyx.com/api/auth/confirm_email?register_code=${jwt}`);
|
||||
// });
|
||||
|
||||
return {
|
||||
error: false,
|
||||
|
||||
Reference in New Issue
Block a user