Skip to content

Commit f773ee4

Browse files
committed
Move tokenLength configuration from passwordless to login for future proof
1 parent 77d1147 commit f773ee4

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

packages/pwa-kit-create-app/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
## v3.15.0-dev (Nov 05, 2025)
33
- Update `default.js` and `/_app-config/index.jsx` template to use email mode by default for passwordless login and password reset. [#3526] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3526) [#3547](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3547)
4-
- Add `tokenLength` to passwordless login configuration [#3554](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3554)
4+
- Add `tokenLength` to login configuration [#3554](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3554)
55

66
## v3.15.0 (Dec 17, 2025)
77
- Add new Google Cloud API configuration and Bonus Product configuration [#3523](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3523)

packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ module.exports = {
5757
interpretPlusSignAsSpace: false
5858
},
5959
login: {
60+
// The length of the token for OTP authentication. Used by passwordless login and reset password.
61+
// Valid values include 6 or 8. Defaults to: 8
62+
tokenLength: 8,
6063
passwordless: {
6164
// Enables or disables passwordless login for the site. Defaults to: false
6265
{{#if answers.project.demo.enableDemoSettings}}
@@ -71,9 +74,7 @@ module.exports = {
7174
// callbackURI:
7275
// process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
7376
// The landing path for passwordless login
74-
landingPath: '/passwordless-login-landing',
75-
// The length of the token for passwordless login. Valid values include 6 or 8. Defaults to: 8
76-
tokenLength: 8
77+
landingPath: '/passwordless-login-landing'
7778
},
7879
social: {
7980
// Enables or disables social login for the site. Defaults to: false

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ module.exports = {
5757
interpretPlusSignAsSpace: false
5858
},
5959
login: {
60+
// The length of the token for OTP authentication. Used by passwordless login and reset password.
61+
// Valid values include 6 or 8. Defaults to: 8
62+
tokenLength: 8,
6063
passwordless: {
6164
// Enables or disables passwordless login for the site. Defaults to: false
6265
{{#if answers.project.demo.enableDemoSettings}}
@@ -71,9 +74,7 @@ module.exports = {
7174
// callbackURI:
7275
// process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
7376
// The landing path for passwordless login
74-
landingPath: '/passwordless-login-landing',
75-
// The length of the token for passwordless login. Valid values include 6 or 8. Defaults to: 8
76-
tokenLength: 8
77+
landingPath: '/passwordless-login-landing'
7778
},
7879
social: {
7980
// Enables or disables social login for the site. Defaults to: false

packages/template-retail-react-app/app/components/otp-auth/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const OtpAuth = ({
3939
isGuestRegistration = false,
4040
hideCheckoutAsGuestButton = false
4141
}) => {
42-
const OTP_LENGTH = getConfig().app.login.passwordless.tokenLength || 8
42+
const OTP_LENGTH = getConfig().app.login.tokenLength || 8
4343
const [isVerifying, setIsVerifying] = useState(false)
4444
const [error, setError] = useState('')
4545
const [resendTimer, setResendTimer] = useCountdown(0)

packages/template-retail-react-app/app/components/otp-auth/index.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ describe('OtpAuth', () => {
127127
...mockConfig.app,
128128
login: {
129129
...mockConfig.app.login,
130-
passwordless: {
131-
...mockConfig.app.login.passwordless,
132-
tokenLength: tokenLength
133-
}
130+
tokenLength
134131
}
135132
}
136133
}))

packages/template-retail-react-app/config/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ module.exports = {
3030
interpretPlusSignAsSpace: false
3131
},
3232
login: {
33+
tokenLength: 8,
3334
passwordless: {
3435
enabled: false,
3536
mode: 'email',
36-
landingPath: '/passwordless-login-landing',
37-
tokenLength: 8
37+
landingPath: '/passwordless-login-landing'
3838
},
3939
social: {
4040
enabled: false,

packages/template-retail-react-app/config/mocks/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ module.exports = {
3333
showDefaults: true
3434
},
3535
login: {
36+
tokenLength: 8,
3637
passwordless: {
3738
enabled: false,
38-
mode: 'email',
39-
tokenLength: 8
39+
mode: 'email'
4040
},
4141
social: {
4242
enabled: false,

0 commit comments

Comments
 (0)