@solidstarters/solid-core 1.2.116 → 1.2.118
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/config/iam.config.d.ts +2 -0
- package/dist/config/iam.config.d.ts.map +1 -1
- package/dist/config/iam.config.js +1 -0
- package/dist/config/iam.config.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +7 -0
- 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 +10 -3
- 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 +2 -1
- package/dist/services/setting.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +14 -19
- package/dist/solid-core.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/config/iam.config.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +7 -0
- package/src/services/authentication.service.ts +13 -7
- package/src/services/setting.service.ts +3 -2
- package/src/solid-core.module.ts +14 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.118",
|
|
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",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"mailgen": "^2.0.28",
|
|
55
55
|
"mongoose": "^8.7.0",
|
|
56
56
|
"mysql2": "^3.13.0",
|
|
57
|
-
"nestjs-cls": "^5.4.3",
|
|
58
57
|
"nodemailer": "^6.9.13",
|
|
59
58
|
"passport": "^0.7.0",
|
|
60
59
|
"passport-google-oauth2": "^0.2.0",
|
|
@@ -88,7 +87,8 @@
|
|
|
88
87
|
"nest-winston": "^1.9.7",
|
|
89
88
|
"typeorm": "^0.3.20",
|
|
90
89
|
"typeorm-naming-strategies": "^4.1.0",
|
|
91
|
-
"winston": "^3.17.0"
|
|
90
|
+
"winston": "^3.17.0",
|
|
91
|
+
"nestjs-cls": "^5.4.3"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@angular-devkit/schematics": "^19.2.6",
|
package/src/config/iam.config.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const iamConfig = registerAs('iam', () => {
|
|
|
12
12
|
defaultRole: process.env.IAM_DEFAULT_ROLE ?? 'Public',
|
|
13
13
|
dummyOtp: process.env.IAM_OTP_DUMMY,
|
|
14
14
|
forgotPasswordSendVerificationTokenOn: process.env.IAM_FORGOT_PASSWORD_SEND_VERIFICATION_TOKEN_ON ?? 'email',
|
|
15
|
-
|
|
15
|
+
forceChangePasswordOnFirstLogin:true,
|
|
16
16
|
googleOauth: {
|
|
17
17
|
clientID: process.env.IAM_GOOGLE_OAUTH_CLIENT_ID,
|
|
18
18
|
clientSecret: process.env.IAM_GOOGLE_OAUTH_CLIENT_SECRET,
|
|
@@ -8811,6 +8811,13 @@
|
|
|
8811
8811
|
"label": "Iam Allow Public Registration"
|
|
8812
8812
|
}
|
|
8813
8813
|
},
|
|
8814
|
+
{
|
|
8815
|
+
"type": "field",
|
|
8816
|
+
"attrs": {
|
|
8817
|
+
"name": "forceChangePasswordOnFirstLogin",
|
|
8818
|
+
"label": "Force Password Change On First Login"
|
|
8819
|
+
}
|
|
8820
|
+
},
|
|
8814
8821
|
{
|
|
8815
8822
|
"type": "field",
|
|
8816
8823
|
"attrs": {
|
|
@@ -82,6 +82,10 @@ export class AuthenticationService {
|
|
|
82
82
|
|
|
83
83
|
) { }
|
|
84
84
|
|
|
85
|
+
private async getConfig( key: string): Promise<any> {
|
|
86
|
+
return this.settingService.getConfigValue(key);
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
private async getCompanyLogo(): Promise<string> {
|
|
86
90
|
return await this.settingService.getConfigValue('companylogo');
|
|
87
91
|
}
|
|
@@ -118,7 +122,7 @@ export class AuthenticationService {
|
|
|
118
122
|
|
|
119
123
|
return user;
|
|
120
124
|
}
|
|
121
|
-
|
|
125
|
+
|
|
122
126
|
async signUp(signUpDto: SignUpDto, activeUser: ActiveUserData = null): Promise<User> {
|
|
123
127
|
// If public registrations are disabled and no activeUser is present when invoking signUp then we throw an exception.
|
|
124
128
|
if (!(await this.settingService.getConfigValue('allowPublicRegistration')) && !activeUser) {
|
|
@@ -126,9 +130,9 @@ export class AuthenticationService {
|
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
try {
|
|
129
|
-
|
|
133
|
+
const onForcePasswordChange = await this.getConfig('forceChangePasswordOnFirstLogin');
|
|
134
|
+
var { user, pwd, autoGeneratedPwd } = await this.populateForSignup(new User(), signUpDto, this.iamConfiguration.activateUserOnRegistration,onForcePasswordChange);
|
|
130
135
|
const savedUser = await this.userRepository.save(user);
|
|
131
|
-
|
|
132
136
|
// Also assign a default role to the newly created user.
|
|
133
137
|
const userRoles = signUpDto.roles ?? [];
|
|
134
138
|
if (this.iamConfiguration.defaultRole) {
|
|
@@ -141,7 +145,7 @@ export class AuthenticationService {
|
|
|
141
145
|
return savedUser;
|
|
142
146
|
} catch (err) {
|
|
143
147
|
const pgUniqueViolationErrorCode = '23505';
|
|
144
|
-
|
|
148
|
+
if (err.code === pgUniqueViolationErrorCode) {
|
|
145
149
|
throw new ConflictException();
|
|
146
150
|
}
|
|
147
151
|
throw err;
|
|
@@ -150,10 +154,11 @@ export class AuthenticationService {
|
|
|
150
154
|
|
|
151
155
|
async signupForExtensionUser<T extends User, U extends CreateUserDto>(signUpDto: SignUpDto, extensionUserDto: U, extensionUserRepo: Repository<T>): Promise<T> {
|
|
152
156
|
try {
|
|
157
|
+
const onForcePasswordChange = await this.getConfig('forceChangePasswordOnFirstLogin');
|
|
153
158
|
// Merge the extended signUpDto attributes into the user entity
|
|
154
159
|
//@ts-ignore
|
|
155
160
|
const extensionUser = extensionUserRepo.merge(extensionUserRepo.create() as T, extensionUserDto);
|
|
156
|
-
var { user, pwd, autoGeneratedPwd } = await this.populateForSignup<T>(extensionUser, signUpDto);
|
|
161
|
+
var { user, pwd, autoGeneratedPwd } = await this.populateForSignup<T>(extensionUser, signUpDto,onForcePasswordChange);
|
|
157
162
|
const savedUser = await extensionUserRepo.save(user);
|
|
158
163
|
|
|
159
164
|
await this.handlePostSignup(savedUser, signUpDto.roles, pwd, autoGeneratedPwd);
|
|
@@ -170,7 +175,7 @@ export class AuthenticationService {
|
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
|
|
173
|
-
private async populateForSignup<T extends User>(user: T, signUpDto: SignUpDto, isUserActive: boolean = true) {
|
|
178
|
+
private async populateForSignup<T extends User>(user: T, signUpDto: SignUpDto, isUserActive: boolean = true,onForcePasswordChange?:boolean) {
|
|
174
179
|
// const user = new User();
|
|
175
180
|
|
|
176
181
|
if (signUpDto.roles && signUpDto.roles.length > 0) {
|
|
@@ -182,10 +187,11 @@ export class AuthenticationService {
|
|
|
182
187
|
user.username = signUpDto.username;
|
|
183
188
|
user.email = signUpDto.email;
|
|
184
189
|
user.fullName = signUpDto.fullName;
|
|
190
|
+
user.forcePasswordChange = onForcePasswordChange;
|
|
185
191
|
if (signUpDto.mobile) {
|
|
186
192
|
user.mobile = signUpDto.mobile;
|
|
187
193
|
}
|
|
188
|
-
|
|
194
|
+
this.logger.debug("user",user);
|
|
189
195
|
// If password has been specified by the user, then we simply create & activate the user based on the configuration parameter "activateUserOnRegistration".
|
|
190
196
|
let pwd = '';
|
|
191
197
|
let autoGeneratedPwd = '';
|
|
@@ -146,7 +146,8 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
146
146
|
shouldQueueEmails: this.commonConfiguration.shouldQueueEmails,
|
|
147
147
|
shouldQueueSms: this.commonConfiguration.shouldQueueSms,
|
|
148
148
|
enableDarkMode: true,
|
|
149
|
-
copyright : ""
|
|
149
|
+
copyright : "",
|
|
150
|
+
forceChangePasswordOnFirstLogin:true
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -154,7 +155,7 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
154
155
|
try {
|
|
155
156
|
const settingsArray: Setting[] = await this.repo.find();
|
|
156
157
|
const settingEntry = settingsArray.find(setting => setting.key === settingKey);
|
|
157
|
-
|
|
158
|
+
|
|
158
159
|
if (settingEntry && settingEntry.value !== null && settingEntry.value !== undefined) {
|
|
159
160
|
const value = settingEntry.value;
|
|
160
161
|
|
package/src/solid-core.module.ts
CHANGED
|
@@ -211,7 +211,19 @@ import { GenerateCodeSubscriber } from './jobs/database/generate-code-subscriber
|
|
|
211
211
|
MqMessageQueue,
|
|
212
212
|
MqMessage,
|
|
213
213
|
PermissionMetadata,
|
|
214
|
-
RoleMetadata
|
|
214
|
+
RoleMetadata,
|
|
215
|
+
Setting,
|
|
216
|
+
SavedFilters,
|
|
217
|
+
UserViewMetadata,
|
|
218
|
+
SecurityRule,
|
|
219
|
+
ListOfValues,
|
|
220
|
+
ChatterMessage,
|
|
221
|
+
ChatterMessageDetails,
|
|
222
|
+
Locale,
|
|
223
|
+
ExportTemplate,
|
|
224
|
+
ExportTransaction,
|
|
225
|
+
ImportTransaction,
|
|
226
|
+
ImportTransactionErrorLog,
|
|
215
227
|
]),
|
|
216
228
|
ConfigModule.forFeature(appBuilderConfig),
|
|
217
229
|
ConfigModule.forFeature(commonConfig),
|
|
@@ -231,24 +243,7 @@ import { GenerateCodeSubscriber } from './jobs/database/generate-code-subscriber
|
|
|
231
243
|
}),
|
|
232
244
|
HttpModule,
|
|
233
245
|
ConfigModule,
|
|
234
|
-
|
|
235
|
-
TypeOrmModule.forFeature([SavedFilters]),
|
|
236
|
-
TypeOrmModule.forFeature([UserViewMetadata]),
|
|
237
|
-
TypeOrmModule.forFeature([SecurityRule]),
|
|
238
|
-
TypeOrmModule.forFeature([SavedFilters]),
|
|
239
|
-
TypeOrmModule.forFeature([ListOfValues]),
|
|
240
|
-
TypeOrmModule.forFeature([ChatterMessage]),
|
|
241
|
-
TypeOrmModule.forFeature([ChatterMessageDetails]),
|
|
242
|
-
TypeOrmModule.forFeature([Locale]),
|
|
243
|
-
TypeOrmModule.forFeature([ExportTemplate]),
|
|
244
|
-
TypeOrmModule.forFeature([ExportTransaction]),
|
|
245
|
-
// TypeOrmModule.forFeature([User]),
|
|
246
|
-
ClsModule.forRoot({
|
|
247
|
-
middleware: {
|
|
248
|
-
mount: true,
|
|
249
|
-
}}),
|
|
250
|
-
TypeOrmModule.forFeature([ImportTransaction]),
|
|
251
|
-
TypeOrmModule.forFeature([ImportTransactionErrorLog]),
|
|
246
|
+
ClsModule,
|
|
252
247
|
],
|
|
253
248
|
controllers: [
|
|
254
249
|
ModuleMetadataController,
|