Skip to content

Commit 08c24d4

Browse files
committed
feat: add SMTP settings component with email testing functionality
- Implemented SMTP settings form in SmtpSettings.vue with validation and connection testing. - Registered SMTP settings component in settings index. - Added connection testing logic for SMTP in useConnectionTest.ts. - Updated i18n translations for SMTP settings and email testing. - Enhanced user experience with alerts and validation messages in the SMTP settings form. - Refactored user login and registration views for cleaner code. - Improved category deletion confirmation dialog in CategoryTableColumns.vue. - Updated styles in index.css for better UI consistency.
1 parent 1ae96ef commit 08c24d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+17152
-16834
lines changed

services/backend/api-spec.json

Lines changed: 6054 additions & 6837 deletions
Large diffs are not rendered by default.

services/backend/api-spec.yaml

Lines changed: 5295 additions & 5545 deletions
Large diffs are not rendered by default.

services/backend/drizzle/migrations_sqlite/0000_brave_maddog.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ CREATE TABLE `authUser` (
2828
FOREIGN KEY (`role_id`) REFERENCES `roles`(`id`) ON UPDATE no action ON DELETE no action
2929
);
3030
--> statement-breakpoint
31-
CREATE UNIQUE INDEX `authUser_username_unique` ON `authUser` (`username`);--> statement-breakpoint
3231
CREATE UNIQUE INDEX `authUser_email_unique` ON `authUser` (`email`);--> statement-breakpoint
3332
CREATE UNIQUE INDEX `authUser_github_id_unique` ON `authUser` (`github_id`);--> statement-breakpoint
3433
CREATE TABLE `emailVerificationTokens` (

services/backend/src/db/schema.sqlite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const roles = sqliteTable('roles', {
2828

2929
export const authUser = sqliteTable('authUser', {
3030
id: text('id').primaryKey(),
31-
username: text('username').notNull().unique(),
31+
username: text('username').notNull(),
3232
email: text('email').notNull().unique(),
3333
auth_type: text('auth_type').notNull(),
3434
first_name: text('first_name'),

services/backend/src/email/example.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export async function sendWelcomeEmailExample(logger: FastifyBaseLogger) {
1717
to: 'newuser@example.com',
1818
userName: 'John Doe',
1919
userEmail: 'newuser@example.com',
20-
loginUrl: 'https://app.deploystack.com/login',
21-
supportEmail: 'support@deploystack.com'
20+
loginUrl: 'https://app.deploystack.io/login',
21+
supportEmail: 'support@deploystack.io'
2222
}, logger);
2323

2424
if (result.success) {
@@ -53,9 +53,9 @@ export async function sendPasswordResetExample(logger: FastifyBaseLogger) {
5353
const result = await EmailService.sendPasswordResetEmail({
5454
to: 'user@example.com',
5555
userName: 'Jane Smith',
56-
resetUrl: 'https://app.deploystack.com/reset-password?token=abc123xyz',
56+
resetUrl: 'https://app.deploystack.io/reset-password?token=abc123xyz',
5757
expirationTime: '24 hours',
58-
supportEmail: 'support@deploystack.com'
58+
supportEmail: 'support@deploystack.io'
5959
}, logger);
6060

6161
if (result.success) {
@@ -91,7 +91,7 @@ export async function sendNotificationExample(logger: FastifyBaseLogger) {
9191
to: 'user@example.com',
9292
title: 'Deployment Complete',
9393
message: 'Your application "my-awesome-app" has been successfully deployed to production.',
94-
actionUrl: 'https://app.deploystack.com/deployments/123',
94+
actionUrl: 'https://app.deploystack.io/deployments/123',
9595
actionText: 'View Deployment Details',
9696
userName: 'Developer'
9797
}, logger);
@@ -133,7 +133,7 @@ export async function sendCustomEmailExample(logger: FastifyBaseLogger) {
133133
variables: {
134134
title: 'Monthly Report Available',
135135
message: 'Your monthly deployment report is ready. Please find the detailed report attached.',
136-
actionUrl: 'https://app.deploystack.com/reports',
136+
actionUrl: 'https://app.deploystack.io/reports',
137137
actionText: 'View Online Report'
138138
},
139139
attachments: [
@@ -247,13 +247,13 @@ export async function listAndValidateTemplatesExample(logger: FastifyBaseLogger)
247247
sampleVariables = {
248248
userName: 'Test User',
249249
userEmail: 'test@example.com',
250-
loginUrl: 'https://app.deploystack.com/login'
250+
loginUrl: 'https://app.deploystack.io/login'
251251
};
252252
break;
253253
case 'password-reset':
254254
sampleVariables = {
255255
userName: 'Test User',
256-
resetUrl: 'https://app.deploystack.com/reset',
256+
resetUrl: 'https://app.deploystack.io/reset',
257257
expirationTime: '24 hours'
258258
};
259259
break;
@@ -319,7 +319,7 @@ export async function userRegistrationIntegrationExample(userData: {
319319
userName: userData.name,
320320
userEmail: userData.email,
321321
loginUrl: `${process.env.FRONTEND_URL || 'http://localhost:5173'}/login`,
322-
supportEmail: 'support@deploystack.com'
322+
supportEmail: 'support@deploystack.io'
323323
}, logger);
324324

325325
if (emailResult.success) {

services/backend/src/global-settings/global.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ export const globalSettings: GlobalSettingsModule = {
1717
encrypted: false,
1818
required: false
1919
},
20-
{
21-
key: 'global.send_mail',
22-
defaultValue: false,
23-
type: 'boolean',
24-
description: 'Enable or disable email sending functionality',
25-
encrypted: false,
26-
required: false
27-
},
2820
{
2921
key: 'global.enable_login',
3022
defaultValue: true,

services/backend/src/global-settings/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ export class GlobalSettingsInitService {
622622
try {
623623
const settings = await Promise.all([
624624
GlobalSettingsService.get('global.page_url'),
625-
GlobalSettingsService.get('global.send_mail'),
625+
GlobalSettingsService.get('smtp.enabled'),
626626
GlobalSettingsService.get('global.enable_login'),
627627
GlobalSettingsService.get('global.enable_email_registration')
628628
]);
@@ -645,7 +645,7 @@ export class GlobalSettingsInitService {
645645
*/
646646
static async isEmailSendingEnabled(): Promise<boolean> {
647647
try {
648-
const setting = await GlobalSettingsService.get('global.send_mail');
648+
const setting = await GlobalSettingsService.get('smtp.enabled');
649649
return setting?.value === 'true';
650650
} catch {
651651
return false; // Default to disabled if there's an error

services/backend/src/global-settings/smtp.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ export const smtpSettings: GlobalSettingsModule = {
99
sort_order: 1
1010
},
1111
settings: [
12+
{
13+
key: 'smtp.enabled',
14+
defaultValue: false,
15+
type: 'boolean',
16+
description: 'Enable or disable email sending functionality',
17+
encrypted: false,
18+
required: false
19+
},
1220
{
1321
key: 'smtp.host',
1422
defaultValue: '',

services/backend/src/middleware/roleMiddleware.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ import { ROLE_DEFINITIONS } from '../permissions/index';
77
// FastifyRequest already has user: User | null from authHook
88
// We'll use the existing type
99

10+
/**
11+
* Basic authentication middleware - just checks if user is logged in
12+
*/
13+
export function requireAuthentication() {
14+
return async (request: FastifyRequest, reply: FastifyReply) => {
15+
// Check if user is authenticated
16+
if (!request.user) {
17+
const errorResponse = {
18+
success: false,
19+
error: 'Authentication required'
20+
};
21+
const jsonString = JSON.stringify(errorResponse);
22+
return reply.status(401).type('application/json').send(jsonString);
23+
}
24+
};
25+
}
26+
1027
/**
1128
* Middleware to check if user has required permission
1229
*/

services/backend/src/routes/admin/email/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default async function adminEmailTestRoute(server: FastifyInstance) {
136136
to: email,
137137
adminUser: adminUserName,
138138
appUrl,
139-
supportEmail: 'support@deploystack.com'
139+
supportEmail: 'support@deploystack.io'
140140
}, request.log);
141141

142142
if (result.success) {

0 commit comments

Comments
 (0)