@tomei/sso 0.35.4 → 0.35.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.35.4",
3
+ "version": "0.35.6",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1820,17 +1820,8 @@ export class User extends UserBase {
1820
1820
  return false;
1821
1821
  }
1822
1822
 
1823
- await User._Repository.update(
1824
- {
1825
- MFAEnabled: 1,
1826
- },
1827
- {
1828
- where: {
1829
- UserId: userId,
1830
- },
1831
- transaction: dbTransaction,
1832
- },
1833
- );
1823
+ user.MFAEnabled = 1;
1824
+ await user.save({ transaction: dbTransaction });
1834
1825
 
1835
1826
  // 5. Retrieve Session
1836
1827
  const userSession = await this._SessionService.retrieveUserSession(
@@ -1851,7 +1842,8 @@ export class User extends UserBase {
1851
1842
  public async verify2FACode(
1852
1843
  userId: number,
1853
1844
  mfaToken: string,
1854
- dbTransaction: any,
1845
+ systemCode?: string,
1846
+ dbTransaction?: any,
1855
1847
  ) {
1856
1848
  // 1. Retrieve user data by calling LoginUser._Repository.findOne with UserId
1857
1849
  const user = await User._Repository.findOne({
@@ -1896,7 +1888,10 @@ export class User extends UserBase {
1896
1888
  const userSession = await this._SessionService.retrieveUserSession(
1897
1889
  `${userId}`,
1898
1890
  );
1899
- const systemCode = ApplicationConfig.getComponentConfigValue('system-code');
1891
+
1892
+ if (!systemCode) {
1893
+ systemCode = ApplicationConfig.getComponentConfigValue('system-code');
1894
+ }
1900
1895
 
1901
1896
  const systemLogin = userSession.systemLogins.find(
1902
1897
  (e) => e.code === systemCode,