@solidstarters/solid-core 1.2.109 → 1.2.111
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 +12 -7
- package/src/seeders/seed-data/email-templates/on-force-password-change.handlebars.html +13 -11
- package/src/seeders/seed-data/email-templates/otp-on-login.handlebars.html +14 -6
- package/src/seeders/seed-data/email-templates/otp-on-register.handlebars.html +18 -7
- 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.111",
|
|
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",
|
|
@@ -116,19 +116,19 @@
|
|
|
116
116
|
|
|
117
117
|
<body>
|
|
118
118
|
<div class="email-wrapper">
|
|
119
|
-
|
|
119
|
+
{{#if companyLogoUrl}}
|
|
120
120
|
<div class="logo">
|
|
121
|
-
<img src="
|
|
121
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
122
122
|
</div>
|
|
123
|
+
{{/if}}
|
|
123
124
|
|
|
124
|
-
<!-- Content Box -->
|
|
125
125
|
<div class="content-box">
|
|
126
|
-
<h2 class="title">Hi
|
|
126
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
127
127
|
<p class="intro">
|
|
128
|
-
|
|
128
|
+
We received a request to reset your password for <strong>{{ solidAppName }}</strong>.
|
|
129
129
|
</p>
|
|
130
130
|
<p class="intro">
|
|
131
|
-
|
|
131
|
+
Please click the link below to set a new password:
|
|
132
132
|
</p>
|
|
133
133
|
<div class="button-container">
|
|
134
134
|
<a href="{{ passwordResetLink }}" class="button" target="_blank">
|
|
@@ -136,7 +136,12 @@
|
|
|
136
136
|
</a>
|
|
137
137
|
</div>
|
|
138
138
|
<p class="footer-text">
|
|
139
|
-
If you
|
|
139
|
+
If you did not request this, please ignore this email.
|
|
140
|
+
</p>
|
|
141
|
+
<p class="intro">
|
|
142
|
+
Regards,
|
|
143
|
+
<br />
|
|
144
|
+
The {{ solidAppName }} Team.
|
|
140
145
|
</p>
|
|
141
146
|
</div>
|
|
142
147
|
|
|
@@ -116,24 +116,25 @@
|
|
|
116
116
|
|
|
117
117
|
<body>
|
|
118
118
|
<div class="email-wrapper">
|
|
119
|
-
|
|
119
|
+
{{#if companyLogoUrl}}
|
|
120
120
|
<div class="logo">
|
|
121
|
-
<img src="
|
|
121
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
122
122
|
</div>
|
|
123
|
+
{{/if}}
|
|
123
124
|
|
|
124
|
-
<!-- Content Box -->
|
|
125
125
|
<div class="content-box">
|
|
126
|
-
<h2 class="title">Hi
|
|
126
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
127
127
|
<p class="intro">
|
|
128
|
-
Welcome
|
|
128
|
+
Welcome aboard! Your account for <strong>{{ solidAppName }}</strong> has been created.
|
|
129
129
|
</p>
|
|
130
|
-
<p class="intro">
|
|
131
|
-
|
|
130
|
+
<p class="intro" style="margin-top: 10px;">
|
|
131
|
+
For your security, you'll be prompted to set a new password upon your first login. Please use the
|
|
132
|
+
temporary password provided to log in for the first time.
|
|
132
133
|
</p>
|
|
133
134
|
|
|
134
135
|
<div class="credentials">
|
|
135
136
|
<p><strong>Email:</strong> {{ email }}</p>
|
|
136
|
-
<p><strong>Password:</strong> {{ password }}</p>
|
|
137
|
+
<p><strong>Temporary Password:</strong> {{ password }}</p>
|
|
137
138
|
</div>
|
|
138
139
|
|
|
139
140
|
<div class="button-container">
|
|
@@ -141,9 +142,10 @@
|
|
|
141
142
|
Login to Your Account
|
|
142
143
|
</a>
|
|
143
144
|
</div>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
<p class="intro">
|
|
146
|
+
Regards,
|
|
147
|
+
<br/ >
|
|
148
|
+
The {{ solidAppName }} Team.
|
|
147
149
|
</p>
|
|
148
150
|
</div>
|
|
149
151
|
|
|
@@ -115,24 +115,32 @@
|
|
|
115
115
|
|
|
116
116
|
<body>
|
|
117
117
|
<div class="email-wrapper">
|
|
118
|
-
|
|
118
|
+
{{#if companyLogoUrl}}
|
|
119
119
|
<div class="logo">
|
|
120
|
-
<img src="
|
|
120
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
121
121
|
</div>
|
|
122
|
+
{{/if}}
|
|
122
123
|
|
|
123
|
-
<!-- Content Box -->
|
|
124
124
|
<div class="content-box">
|
|
125
|
-
<h2 class="title">Hi
|
|
125
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
126
126
|
<p class="intro">
|
|
127
|
-
|
|
127
|
+
Your One-Time Password (OTP) to log in to <strong>{{ solidAppName }}</strong> is:
|
|
128
128
|
</p>
|
|
129
129
|
<div class="button-container">
|
|
130
130
|
<div class="button">
|
|
131
131
|
{{ emailVerificationTokenOnLogin }}
|
|
132
132
|
</div>
|
|
133
133
|
</div>
|
|
134
|
+
<p class="intro">
|
|
135
|
+
This code is valid for 10 minutes.
|
|
136
|
+
</p>
|
|
134
137
|
<p class="footer-text">
|
|
135
|
-
If you
|
|
138
|
+
If you did not attempt to log in, please disregard this email or contact our support team.
|
|
139
|
+
</p>
|
|
140
|
+
<p class="intro">
|
|
141
|
+
Regards,
|
|
142
|
+
<br />
|
|
143
|
+
The {{ solidAppName }} Team.
|
|
136
144
|
</p>
|
|
137
145
|
</div>
|
|
138
146
|
|
|
@@ -115,25 +115,36 @@
|
|
|
115
115
|
|
|
116
116
|
<body>
|
|
117
117
|
<div class="email-wrapper">
|
|
118
|
-
|
|
118
|
+
{{#if companyLogoUrl}}
|
|
119
119
|
<div class="logo">
|
|
120
|
-
<img src="
|
|
120
|
+
<img src="{{companyLogoUrl}}" alt="Company Logo" />
|
|
121
121
|
</div>
|
|
122
|
+
{{/if}}
|
|
122
123
|
|
|
123
|
-
<!-- Content Box -->
|
|
124
124
|
<div class="content-box">
|
|
125
|
-
<h2 class="title">Hi
|
|
125
|
+
<h2 class="title">Hi {{ fullName }},</h2>
|
|
126
126
|
<p class="intro">
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
Thank you for signing up for <strong>{{ solidAppName }}!</strong>
|
|
128
|
+
</p>
|
|
129
|
+
<p class="intro" style="margin-top: 10px;">
|
|
130
|
+
To complete your registration, please use the following One-Time Password (OTP) to verify your email
|
|
131
|
+
address:
|
|
129
132
|
</p>
|
|
130
133
|
<div class="button-container">
|
|
131
134
|
<div class="button">
|
|
132
135
|
{{ emailVerificationTokenOnRegistration }}
|
|
133
136
|
</div>
|
|
134
137
|
</div>
|
|
138
|
+
<p class="intro">
|
|
139
|
+
This code is valid for 10 minutes. Please do not share this code with anyone.
|
|
140
|
+
</p>
|
|
135
141
|
<p class="footer-text">
|
|
136
|
-
If you
|
|
142
|
+
If you did not attempt to sign up, please disregard this email.
|
|
143
|
+
</p>
|
|
144
|
+
<p class="intro">
|
|
145
|
+
Regards,
|
|
146
|
+
<br />
|
|
147
|
+
The {{ solidAppName }} Team.
|
|
137
148
|
</p>
|
|
138
149
|
</div>
|
|
139
150
|
|
|
@@ -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
|
}
|