@solidstarters/solid-core 1.2.109 → 1.2.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/seeders/seed-data/solid-core-metadata.json +4 -4
- package/dist/services/authentication.service.d.ts +1 -0
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +21 -6
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/setting.service.d.ts.map +1 -1
- package/dist/services/setting.service.js +8 -3
- package/dist/services/setting.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/seeders/seed-data/email-templates/forgot-password.handlebars.html +15 -5
- package/src/seeders/seed-data/email-templates/on-force-password-change.handlebars.html +19 -9
- package/src/seeders/seed-data/email-templates/otp-on-login.handlebars.html +17 -4
- package/src/seeders/seed-data/email-templates/otp-on-register.handlebars.html +21 -5
- package/src/seeders/seed-data/solid-core-metadata.json +4 -4
- package/src/services/authentication.service.ts +24 -7
- package/src/services/setting.service.ts +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.110",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -117,18 +117,23 @@
|
|
|
117
117
|
<body>
|
|
118
118
|
<div class="email-wrapper">
|
|
119
119
|
<!-- Logo outside the box -->
|
|
120
|
+
{{#if companyLogoUrl}}
|
|
120
121
|
<div class="logo">
|
|
121
|
-
<img src="
|
|
122
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
123
|
+
<!-- {{else}}
|
|
124
|
+
//fallback svg logo here
|
|
125
|
+
{{/if}} -->
|
|
122
126
|
</div>
|
|
127
|
+
{{/if}}
|
|
123
128
|
|
|
124
129
|
<!-- Content Box -->
|
|
125
130
|
<div class="content-box">
|
|
126
|
-
<h2 class="title">Hi
|
|
131
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
127
132
|
<p class="intro">
|
|
128
|
-
|
|
133
|
+
We received a request to reset your password for <strong>{{ solidAppName }}</strong>.
|
|
129
134
|
</p>
|
|
130
135
|
<p class="intro">
|
|
131
|
-
|
|
136
|
+
Please click the link below to set a new password:
|
|
132
137
|
</p>
|
|
133
138
|
<div class="button-container">
|
|
134
139
|
<a href="{{ passwordResetLink }}" class="button" target="_blank">
|
|
@@ -136,7 +141,12 @@
|
|
|
136
141
|
</a>
|
|
137
142
|
</div>
|
|
138
143
|
<p class="footer-text">
|
|
139
|
-
If you
|
|
144
|
+
If you did not request this, please ignore this email.
|
|
145
|
+
</p>
|
|
146
|
+
<p class="intro">
|
|
147
|
+
Regards,
|
|
148
|
+
<br />
|
|
149
|
+
The {{ solidAppName }} Team.
|
|
140
150
|
</p>
|
|
141
151
|
</div>
|
|
142
152
|
|
|
@@ -117,23 +117,29 @@
|
|
|
117
117
|
<body>
|
|
118
118
|
<div class="email-wrapper">
|
|
119
119
|
<!-- Logo outside the box -->
|
|
120
|
+
{{#if companyLogoUrl}}
|
|
120
121
|
<div class="logo">
|
|
121
|
-
<img src="
|
|
122
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
123
|
+
<!-- {{else}}
|
|
124
|
+
//fallback svg logo here
|
|
125
|
+
{{/if}} -->
|
|
122
126
|
</div>
|
|
127
|
+
{{/if}}
|
|
123
128
|
|
|
124
129
|
<!-- Content Box -->
|
|
125
130
|
<div class="content-box">
|
|
126
|
-
<h2 class="title">Hi
|
|
131
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
127
132
|
<p class="intro">
|
|
128
|
-
Welcome
|
|
133
|
+
Welcome aboard! Your account for <strong>{{ solidAppName }}</strong> has been created.
|
|
129
134
|
</p>
|
|
130
|
-
<p class="intro">
|
|
131
|
-
|
|
135
|
+
<p class="intro" style="margin-top: 10px;">
|
|
136
|
+
For your security, you'll be prompted to set a new password upon your first login. Please use the
|
|
137
|
+
temporary password provided to log in for the first time.
|
|
132
138
|
</p>
|
|
133
139
|
|
|
134
140
|
<div class="credentials">
|
|
135
141
|
<p><strong>Email:</strong> {{ email }}</p>
|
|
136
|
-
<p><strong>Password:</strong> {{ password }}</p>
|
|
142
|
+
<p><strong>Temporary Password:</strong> {{ password }}</p>
|
|
137
143
|
</div>
|
|
138
144
|
|
|
139
145
|
<div class="button-container">
|
|
@@ -141,10 +147,14 @@
|
|
|
141
147
|
Login to Your Account
|
|
142
148
|
</a>
|
|
143
149
|
</div>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
<p class="intro">
|
|
151
|
+
Regards,
|
|
152
|
+
<br/ >
|
|
153
|
+
The {{ solidAppName }} Team.
|
|
147
154
|
</p>
|
|
155
|
+
<!-- <p class="footer-text">
|
|
156
|
+
If you have any questions, just reply to this email—we’re happy to help.
|
|
157
|
+
</p> -->
|
|
148
158
|
</div>
|
|
149
159
|
|
|
150
160
|
<div class="footer">
|
|
@@ -116,23 +116,36 @@
|
|
|
116
116
|
<body>
|
|
117
117
|
<div class="email-wrapper">
|
|
118
118
|
<!-- Logo outside the box -->
|
|
119
|
+
{{#if companyLogoUrl}}
|
|
119
120
|
<div class="logo">
|
|
120
|
-
<img src="
|
|
121
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
122
|
+
<!-- {{else}}
|
|
123
|
+
//fallback svg logo here
|
|
124
|
+
{{/if}} -->
|
|
121
125
|
</div>
|
|
126
|
+
{{/if}}
|
|
122
127
|
|
|
123
128
|
<!-- Content Box -->
|
|
124
129
|
<div class="content-box">
|
|
125
|
-
<h2 class="title">Hi
|
|
130
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
126
131
|
<p class="intro">
|
|
127
|
-
|
|
132
|
+
Your One-Time Password (OTP) to log in to <strong>{{ solidAppName }}</strong> is:
|
|
128
133
|
</p>
|
|
129
134
|
<div class="button-container">
|
|
130
135
|
<div class="button">
|
|
131
136
|
{{ emailVerificationTokenOnLogin }}
|
|
132
137
|
</div>
|
|
133
138
|
</div>
|
|
139
|
+
<p class="intro">
|
|
140
|
+
This code is valid for 10 minutes.
|
|
141
|
+
</p>
|
|
134
142
|
<p class="footer-text">
|
|
135
|
-
If you
|
|
143
|
+
If you did not attempt to log in, please disregard this email or contact our support team.
|
|
144
|
+
</p>
|
|
145
|
+
<p class="intro">
|
|
146
|
+
Regards,
|
|
147
|
+
<br />
|
|
148
|
+
The {{ solidAppName }} Team.
|
|
136
149
|
</p>
|
|
137
150
|
</div>
|
|
138
151
|
|
|
@@ -116,24 +116,40 @@
|
|
|
116
116
|
<body>
|
|
117
117
|
<div class="email-wrapper">
|
|
118
118
|
<!-- Logo outside the box -->
|
|
119
|
+
{{#if companyLogoUrl}}
|
|
119
120
|
<div class="logo">
|
|
120
|
-
<img src="
|
|
121
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
122
|
+
<!-- {{else}}
|
|
123
|
+
//fallback svg logo here
|
|
124
|
+
{{/if}} -->
|
|
121
125
|
</div>
|
|
126
|
+
{{/if}}
|
|
122
127
|
|
|
123
128
|
<!-- Content Box -->
|
|
124
129
|
<div class="content-box">
|
|
125
|
-
<h2 class="title">Hi
|
|
130
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
126
131
|
<p class="intro">
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
Thank you for signing up for <strong>{{ solidAppName }}!</strong>
|
|
133
|
+
</p>
|
|
134
|
+
<p class="intro" style="margin-top: 10px;">
|
|
135
|
+
To complete your registration, please use the following One-Time Password (OTP) to verify your email
|
|
136
|
+
address:
|
|
129
137
|
</p>
|
|
130
138
|
<div class="button-container">
|
|
131
139
|
<div class="button">
|
|
132
140
|
{{ emailVerificationTokenOnRegistration }}
|
|
133
141
|
</div>
|
|
134
142
|
</div>
|
|
143
|
+
<p class="intro">
|
|
144
|
+
This code is valid for 10 minutes. Please do not share this code with anyone.
|
|
145
|
+
</p>
|
|
135
146
|
<p class="footer-text">
|
|
136
|
-
If you
|
|
147
|
+
If you did not attempt to sign up, please disregard this email.
|
|
148
|
+
</p>
|
|
149
|
+
<p class="intro">
|
|
150
|
+
Regards,
|
|
151
|
+
<br />
|
|
152
|
+
The {{ solidAppName }} Team.
|
|
137
153
|
</p>
|
|
138
154
|
</div>
|
|
139
155
|
|
|
@@ -9300,7 +9300,7 @@
|
|
|
9300
9300
|
"name": "on-force-password-change",
|
|
9301
9301
|
"displayName": "Default: On Force Password Change",
|
|
9302
9302
|
"body": "on-force-password-change.handlebars.html",
|
|
9303
|
-
"subject": "{{solidAppName}}
|
|
9303
|
+
"subject": "Welcome to {{solidAppName}}!",
|
|
9304
9304
|
"description": "When using password based signUp, if the user does not specify the password of the new account being created the system automatically triggers a force password change email.",
|
|
9305
9305
|
"active": true,
|
|
9306
9306
|
"type": "text"
|
|
@@ -9309,7 +9309,7 @@
|
|
|
9309
9309
|
"name": "otp-on-register",
|
|
9310
9310
|
"displayName": "Default: Otp On Register",
|
|
9311
9311
|
"body": "otp-on-register.handlebars.html",
|
|
9312
|
-
"subject": "{{solidAppName}}
|
|
9312
|
+
"subject": "Verify Your Email for {{solidAppName}}",
|
|
9313
9313
|
"description": "This template is used to generate the account verification email sent to users to verify their email address when they register.",
|
|
9314
9314
|
"active": true,
|
|
9315
9315
|
"type": "text"
|
|
@@ -9318,7 +9318,7 @@
|
|
|
9318
9318
|
"name": "otp-on-login",
|
|
9319
9319
|
"displayName": "Default: Otp On Login",
|
|
9320
9320
|
"body": "otp-on-login.handlebars.html",
|
|
9321
|
-
"subject": "{{solidAppName}}
|
|
9321
|
+
"subject": "Your One-Time Password for {{solidAppName}}",
|
|
9322
9322
|
"description": "This template is used to send the email with the OTP when logging in.",
|
|
9323
9323
|
"active": true,
|
|
9324
9324
|
"type": "text"
|
|
@@ -9327,7 +9327,7 @@
|
|
|
9327
9327
|
"name": "forgot-password",
|
|
9328
9328
|
"displayName": "Default: Forgot Password",
|
|
9329
9329
|
"body": "forgot-password.handlebars.html",
|
|
9330
|
-
"subject": "{{solidAppName}}
|
|
9330
|
+
"subject": "Reset Your Password for {{solidAppName}}",
|
|
9331
9331
|
"description": "This template is used to send the verification token required by users to reset their password.",
|
|
9332
9332
|
"active": true,
|
|
9333
9333
|
"type": "text"
|
|
@@ -82,6 +82,10 @@ export class AuthenticationService {
|
|
|
82
82
|
|
|
83
83
|
) { }
|
|
84
84
|
|
|
85
|
+
private async getCompanyLogo(): Promise<string> {
|
|
86
|
+
return await this.settingService.getConfigValue('companylogo');
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
async resolveUser(username: string, email: string) {
|
|
86
90
|
return await this.userRepository.findOne({
|
|
87
91
|
where: [
|
|
@@ -235,7 +239,8 @@ export class AuthenticationService {
|
|
|
235
239
|
return password;
|
|
236
240
|
}
|
|
237
241
|
|
|
238
|
-
private notifyUserOnForcePasswordChange(user: User, autoGeneratedPwd: string) {
|
|
242
|
+
private async notifyUserOnForcePasswordChange(user: User, autoGeneratedPwd: string) {
|
|
243
|
+
const companyLogo = await this.getCompanyLogo();
|
|
239
244
|
|
|
240
245
|
this.mailService.sendEmailUsingTemplate(
|
|
241
246
|
user.email,
|
|
@@ -244,9 +249,11 @@ export class AuthenticationService {
|
|
|
244
249
|
solidAppName: process.env.SOLID_APP_NAME,
|
|
245
250
|
solidAppWebsiteUrl: process.env.SOLID_APP_WEBSITE_URL,
|
|
246
251
|
frontendLoginPageUrl: process.env.IAM_FRONTEND_APP_LOGIN_PAGE_URL,
|
|
252
|
+
email: user.email,
|
|
247
253
|
fullName: user.fullName,
|
|
248
254
|
userName: user.username,
|
|
249
255
|
password: autoGeneratedPwd,
|
|
256
|
+
companyLogoUrl: companyLogo
|
|
250
257
|
},
|
|
251
258
|
this.commonConfiguration.shouldQueueEmails,
|
|
252
259
|
'user',
|
|
@@ -351,7 +358,8 @@ export class AuthenticationService {
|
|
|
351
358
|
}
|
|
352
359
|
}
|
|
353
360
|
|
|
354
|
-
private notifyUserOnOtpInitiateRegistration(user: User, registrationValidationSources: string[]) {
|
|
361
|
+
private async notifyUserOnOtpInitiateRegistration(user: User, registrationValidationSources: string[]) {
|
|
362
|
+
const companyLogo = await this.getCompanyLogo();
|
|
355
363
|
if (this.iamConfiguration.dummyOtp)
|
|
356
364
|
return; // Do nothing if dummy otp is configured.
|
|
357
365
|
if (registrationValidationSources.includes(RegistrationValidationSource.EMAIL)) {
|
|
@@ -364,6 +372,7 @@ export class AuthenticationService {
|
|
|
364
372
|
firstName: user.username,
|
|
365
373
|
fullName: user.fullName ? user.fullName : user.username,
|
|
366
374
|
emailVerificationTokenOnRegistration: user.emailVerificationTokenOnRegistration,
|
|
375
|
+
companyLogoUrl: companyLogo
|
|
367
376
|
},
|
|
368
377
|
this.commonConfiguration.shouldQueueEmails,
|
|
369
378
|
'user',
|
|
@@ -380,6 +389,7 @@ export class AuthenticationService {
|
|
|
380
389
|
mobileVerificationTokenOnRegistration: user.mobileVerificationTokenOnRegistration,
|
|
381
390
|
firstName: user.username,
|
|
382
391
|
fullName: user.fullName ? user.fullName : user.username,
|
|
392
|
+
companyLogoUrl: companyLogo
|
|
383
393
|
}
|
|
384
394
|
);
|
|
385
395
|
}
|
|
@@ -532,7 +542,9 @@ export class AuthenticationService {
|
|
|
532
542
|
return { message: 'User login initiated. OTP sent to the user.' };
|
|
533
543
|
}
|
|
534
544
|
|
|
535
|
-
private notifyUserOnOtpInititateLogin(user: User, loginType: RegistrationValidationSource) {
|
|
545
|
+
private async notifyUserOnOtpInititateLogin(user: User, loginType: RegistrationValidationSource) {
|
|
546
|
+
const companyLogo = await this.getCompanyLogo();
|
|
547
|
+
|
|
536
548
|
if (this.iamConfiguration.dummyOtp)
|
|
537
549
|
return; // Do nothing if dummy otp is configured.
|
|
538
550
|
if (loginType === RegistrationValidationSource.EMAIL) {
|
|
@@ -545,6 +557,7 @@ export class AuthenticationService {
|
|
|
545
557
|
firstName: user.username,
|
|
546
558
|
emailVerificationTokenOnLogin: user.emailVerificationTokenOnLogin,
|
|
547
559
|
fullName: user.fullName ? user.fullName : user.username,
|
|
560
|
+
companyLogoUrl: companyLogo
|
|
548
561
|
},
|
|
549
562
|
this.commonConfiguration.shouldQueueEmails,
|
|
550
563
|
'user',
|
|
@@ -561,6 +574,7 @@ export class AuthenticationService {
|
|
|
561
574
|
mobileVerificationTokenOnLogin: user.mobileVerificationTokenOnLogin,
|
|
562
575
|
firstName: user.username,
|
|
563
576
|
fullName: user.fullName ? user.fullName : user.username,
|
|
577
|
+
companyLogoUrl: companyLogo
|
|
564
578
|
}
|
|
565
579
|
);
|
|
566
580
|
}
|
|
@@ -732,7 +746,9 @@ export class AuthenticationService {
|
|
|
732
746
|
}
|
|
733
747
|
}
|
|
734
748
|
|
|
735
|
-
private notifyUserOnForgotPassword(user: User) {
|
|
749
|
+
private async notifyUserOnForgotPassword(user: User) {
|
|
750
|
+
const companyLogo = await this.getCompanyLogo();
|
|
751
|
+
|
|
736
752
|
const forgotPasswordSendVerificationTokenOn = this.iamConfiguration.forgotPasswordSendVerificationTokenOn;
|
|
737
753
|
|
|
738
754
|
if (forgotPasswordSendVerificationTokenOn == ForgotPasswordSendVerificationTokenOn.EMAIL) {
|
|
@@ -745,7 +761,8 @@ export class AuthenticationService {
|
|
|
745
761
|
firstName: user.username,
|
|
746
762
|
fullName: user.fullName,
|
|
747
763
|
// TODO: Need to prefix this with the page url where the forgot password page will open up.
|
|
748
|
-
passwordResetLink: `${process.env.IAM_FRONTEND_APP_FORGOT_PASSWORD_PAGE_URL}?token=${user.verificationTokenOnForgotPassword}&username=${user.username}
|
|
764
|
+
passwordResetLink: `${process.env.IAM_FRONTEND_APP_FORGOT_PASSWORD_PAGE_URL}?token=${user.verificationTokenOnForgotPassword}&username=${user.username}`,
|
|
765
|
+
companyLogoUrl: companyLogo
|
|
749
766
|
},
|
|
750
767
|
this.commonConfiguration.shouldQueueEmails,
|
|
751
768
|
'user',
|
|
@@ -761,8 +778,8 @@ export class AuthenticationService {
|
|
|
761
778
|
solidAppName: process.env.SOLID_APP_NAME,
|
|
762
779
|
otp: user.verificationTokenOnForgotPassword,
|
|
763
780
|
verificationTokenOnForgotPassword: user.verificationTokenOnForgotPassword,
|
|
764
|
-
firstName: user.username
|
|
765
|
-
|
|
781
|
+
firstName: user.username,
|
|
782
|
+
companyLogoUrl: companyLogo
|
|
766
783
|
}
|
|
767
784
|
);
|
|
768
785
|
}
|
|
@@ -49,6 +49,7 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
49
49
|
authPagesTheme: "light",
|
|
50
50
|
appLogo: "",
|
|
51
51
|
companylogo: "",
|
|
52
|
+
favicon: "",
|
|
52
53
|
appLogoPosition: "in_form_view",
|
|
53
54
|
showAuthContent: false,
|
|
54
55
|
appTitle: process.env.SOLID_APP_NAME || "Solid App",
|
|
@@ -132,6 +133,7 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
132
133
|
authPagesTheme: "light",
|
|
133
134
|
appLogo: "",
|
|
134
135
|
companylogo: "",
|
|
136
|
+
favicon: "",
|
|
135
137
|
appLogoPosition: "in_form_view", //in_form_view | in_image_view
|
|
136
138
|
showAuthContent: false,
|
|
137
139
|
appTitle: process.env.SOLID_APP_NAME || "Solid App",
|
|
@@ -188,7 +190,10 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
188
190
|
if (files && files.length > 0) {
|
|
189
191
|
for (const file of files) {
|
|
190
192
|
const key = file.fieldname;
|
|
191
|
-
const
|
|
193
|
+
const relativePath = `${file.filename}-${file.originalname}`;
|
|
194
|
+
const fileStoragePath = `${this.configService.get('app-builder.fileStorageDir')}/${relativePath}`;
|
|
195
|
+
const baseUrl = process.env.BASE_URL || '';
|
|
196
|
+
const fullUrl = `${baseUrl}/${fileStoragePath}`;
|
|
192
197
|
|
|
193
198
|
await this.fileService.copyFile(file.path, fileStoragePath);
|
|
194
199
|
await this.fileService.deleteFile(file.path);
|
|
@@ -196,13 +201,13 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
196
201
|
if (existingKeys.has(key)) {
|
|
197
202
|
const existingSetting = existingSettings.find(s => s.key === key);
|
|
198
203
|
if (existingSetting) {
|
|
199
|
-
existingSetting.value =
|
|
204
|
+
existingSetting.value = fullUrl;
|
|
200
205
|
settingsToUpdate.push(existingSetting);
|
|
201
206
|
}
|
|
202
207
|
} else {
|
|
203
208
|
const newSetting = new Setting();
|
|
204
209
|
newSetting.key = key;
|
|
205
|
-
newSetting.value =
|
|
210
|
+
newSetting.value = fullUrl;
|
|
206
211
|
settingsToCreate.push(newSetting);
|
|
207
212
|
}
|
|
208
213
|
}
|