Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SMS based password recovery configuration support to password recovery connector. #5808

Merged
merged 26 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a9cbf28
Add config to enable SMS based password recovery
RushanNanayakkara Mar 21, 2024
989c6b8
Merge remote-tracking branch 'upstream/master' into sms_otp_pw_recovery
RushanNanayakkara Apr 2, 2024
68a08c9
Add email link password recovery option to PasswordRecoveryConfigurat…
RushanNanayakkara Apr 5, 2024
878536b
Merge remote-tracking branch 'upstream/master' into sms_otp_pw_recovery
RushanNanayakkara Apr 9, 2024
9cacf46
Merge remote-tracking branch 'upstream/master' into sms_otp_pw_recovery
RushanNanayakkara Apr 13, 2024
67339e3
Replace sms otp regex with individual configs
RushanNanayakkara Apr 17, 2024
fd44065
Restructure Password Recovery Form
RushanNanayakkara Apr 17, 2024
6f41e2a
Block disabling the last enabled otp character set
RushanNanayakkara Apr 17, 2024
1ad0172
Code clean up
RushanNanayakkara Apr 19, 2024
6d4b565
Add otp max resend config
RushanNanayakkara Apr 22, 2024
f03b2bc
style fixes
RushanNanayakkara Apr 22, 2024
6e1d095
Style changes
RushanNanayakkara Apr 23, 2024
8191574
Add maxFailedAttemptCount to recovery form and restructure the form.
RushanNanayakkara Apr 23, 2024
e7e6aa0
Addressing comments
RushanNanayakkara Apr 24, 2024
64392b4
Remove ACCOUNT_RECOVERY_CONNECTOR_ID case from resolveConnectorToggle…
RushanNanayakkara Apr 26, 2024
3d1b1a2
style fix
RushanNanayakkara Apr 26, 2024
5e163e6
fix style issues
RushanNanayakkara Apr 26, 2024
a61e895
Move password recovery form styles to scss file
RushanNanayakkara Apr 26, 2024
82cf920
Add change set
RushanNanayakkara Apr 26, 2024
d11ec93
Remove Recovery.Notification.Password.Enable config being passed with…
RushanNanayakkara May 1, 2024
0f1a690
change changeset
RushanNanayakkara May 7, 2024
f213fc3
Suggestions from review
RushanNanayakkara May 7, 2024
2576d0c
Add beta tag for new featuers and rename otherConfigHeading to failed…
RushanNanayakkara May 13, 2024
f2ffc17
Fix style issue
RushanNanayakkara May 13, 2024
89af46a
Apply suggestions from code review
RushanNanayakkara May 14, 2024
8778e6a
Apply suggested config name change
RushanNanayakkara May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/quick-pears-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/features": minor
"@wso2is/console": patch
---

Add SMS OTP configurations for the password recovery connector edit page.
18 changes: 16 additions & 2 deletions apps/console/src/extensions/i18n/models/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3035,10 +3035,24 @@ export interface Extensions {
form: {
fields: {
enable: FormAttributes;
enableSMSBasedRecovery: FormAttributes;
enableEmailBasedRecovery: FormAttributes;
expiryTime: FormAttributes;
notifySuccess: FormAttributes;
};
};
maxResendCount: FormAttributes;
maxFailedAttemptCount: FormAttributes;
smsOtpExpiryTime: FormAttributes;
passwordRecoveryOtpUseUppercase: FormAttributes;
passwordRecoveryOtpUseLowercase: FormAttributes;
passwordRecoveryOtpUseNumeric: FormAttributes;
passwordRecoveryOtpLength: FormAttributes;
};
};
recoveryOptionSubHeadingEmailLink: string;
recoveryOptionSubHeadingSMS: string;
recoveryOptionHeading: string;
otpConfigHeading: string;
failedAttemptConfigHeading: string;
connectorDescription: string;
heading: string;
notification: {
Expand Down
78 changes: 76 additions & 2 deletions apps/console/src/extensions/i18n/resources/en-US/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3554,6 +3554,10 @@ export const extensions: Extensions = {
hint: "Enabling this will let the users reset their password using an email.",
label: "Enable"
},
enableSMSBasedRecovery: {
hint: "This specifies whether to send an SMS OTP to the mobile.",
label: "Enable SMS based recovery"
},
expiryTime: {
hint: "Password recovery link expiry time in minutes.",
label: "Recovery link expiry time",
Expand All @@ -3573,9 +3577,80 @@ export const extensions: Extensions = {
"This specifies whether to notify the user via an email when password " +
"recovery is successful.",
label: "Notify on successful recovery"
},
maxResendCount: {
hint: "Password recovery maximum resend count.",
label: "Maximum resend attempts count",
placeholder: "Enter max resend count",
validations: {
invalid: "Password recovery OTP resend count should be an integer.",
empty: "Password recovery OTP resend count cannot be empty.",
range:
"Password recovery OTP resend count should be between 1 & 5.",
maxLengthReached:
"Password recovery OTP resend count should be a number with 1 digits."
}
},
maxFailedAttemptCount: {
hint: "Password recovery maximum failed attempt count.",
label: "Max failed attempts count",
placeholder: "Enter max failed attempts",
validations: {
invalid: "Password recovery max failed attempts count should be an integer.",
empty: "Password recovery max failed attempts count cannot be empty.",
range:
"Password recovery max failed attempts count should be between 1 & 10.",
maxLengthReached:
"Password recovery max failed attempts count should be a number with less than 3 digits."
}
},
smsOtpExpiryTime: {
hint: "Password recovery OTP expiry time in minutes.",
label: "Password recovery OTP expiry time",
placeholder: "Enter expiry time",
validations: {
invalid: "Password recovery OTP expiry time should be an integer.",
empty: "Password recovery OTP expiry time cannot be empty.",
range:
"Password recovery OTP expiry time should be between 1 minute & 1440 minutes " +
"(1 day).",
maxLengthReached:
"Password recovery OTP expiry time should be a number with 4 or less digits."
}
},
passwordRecoveryOtpUseUppercase: {
hint: "This specifies whether to use upper case characters in the password recovery otp code.",
label: "Include upper case letters"
},
passwordRecoveryOtpUseLowercase: {
hint: "This specifies whether to use lower case characters in the password recovery otp code.",
label: "Include lower case letters"
},
passwordRecoveryOtpUseNumeric: {
hint: "This specifies whether to use numeric characters in the password recovery otp code.",
label: "Include numeric characters"
},
passwordRecoveryOtpLength: {
hint: "Password recovery OTP length in characters",
label: "Password recovery OTP code length",
placeholder: "Enter OTP code length",
validations: {
empty: "Password recovery OTP length cannot be empty.",
maxLengthReached:
"Password recovery OTP length should be between 6 and 10 characters."
}
},
enableEmailBasedRecovery: {
hint: "This specifies whether to send an recovery link to the email address.",
label: "Enable email link based recovery"
pavinduLakshan marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
recoveryOptionSubHeadingEmailLink: "Email Link",
recoveryOptionSubHeadingSMS: "SMS OTP",
recoveryOptionHeading: "Recovery Option Selection",
otpConfigHeading: "OTP Code Configuration",
failedAttemptConfigHeading: "Recovery Attempts Limitation",
connectorDescription: "Enable self-service password recovery for users " + "on the login page.",
heading: "Password Recovery",
notification: {
Expand All @@ -3589,8 +3664,7 @@ export const extensions: Extensions = {
}
},
subHeading:
"Enable self-service password recovery for users " +
"on the login page.\nThe user will receive a password reset link via email upon request."
"Enable self-service password recovery for users on the login page."
},
subHeading: "Account Recovery related settings."
},
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"appFaviconPath": "/assets/images/branding/favicon.ico",
"isGOTEnabledForSuperTenantOnly": true,
"showAppSwitchButton": true,
"showSmsOtpPwdRecoveryFeatureStatusChip": false,
"features": {
"administrators": {
"disabledFeatures": [],
Expand Down
2 changes: 2 additions & 0 deletions features/admin.core.v1/configs/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ export class Config {
productVersionConfig: window[ "AppUtils" ]?.getConfig()?.ui?.productVersionConfig,
selfAppIdentifier: window[ "AppUtils" ]?.getConfig()?.ui?.selfAppIdentifier,
showAppSwitchButton: window[ "AppUtils" ]?.getConfig()?.ui?.showAppSwitchButton,
showSmsOtpPwdRecoveryFeatureStatusChip:
window[ "AppUtils" ]?.getConfig()?.ui?.showSmsOtpPwdRecoveryFeatureStatusChip,
systemAppsIdentifiers: window[ "AppUtils" ]?.getConfig()?.ui?.systemAppsIdentifiers,
theme: window[ "AppUtils" ]?.getConfig()?.ui?.theme,
useRoleClaimAsGroupClaim: window[ "AppUtils" ]?.getConfig()?.ui?.useRoleClaimAsGroupClaim
Expand Down
4 changes: 4 additions & 0 deletions features/admin.core.v1/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ export interface UIConfigInterface extends CommonUIConfigInterface<FeatureConfig
* Configurations for IDP templates.
*/
connectionTemplates?: any;
/**
* Config if beta tag should be displayed for sms otp for password recovery feature.
*/
showSmsOtpPwdRecoveryFeatureStatusChip?: boolean;
}

/**
Expand Down
1 change: 1 addition & 0 deletions features/admin.core.v1/store/reducers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const commonConfigReducerInitialState: CommonConfigReducerStateInterface<
productVersionConfig: null,
selfAppIdentifier: "",
showAppSwitchButton: undefined,
showSmsOtpPwdRecoveryFeatureStatusChip: undefined,
systemAppsIdentifiers: [],
theme: {
name: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,40 @@ export class GovernanceConnectorConstants {
EXPIRY_TIME_MAX_VALUE: number;
EXPIRY_TIME_MIN_LENGTH: number;
EXPIRY_TIME_MIN_VALUE: number;
MAX_FAILED_ATTEMPT_COUNT_MIN_LENGTH: number;
MAX_FAILED_ATTEMPT_COUNT_MAX_LENGTH: number;
MAX_FAILED_ATTEMPT_COUNT_MIN_VALUE: number;
MAX_FAILED_ATTEMPT_COUNT_MAX_VALUE: number;
MAX_RESEND_COUNT_MIN_LENGTH: number;
MAX_RESEND_COUNT_MAX_LENGTH: number;
MAX_RESEND_COUNT_MIN_VALUE: number;
MAX_RESEND_COUNT_MAX_VALUE: number;
SMS_OTP_EXPIRY_TIME_MAX_LENGTH: number;
SMS_OTP_EXPIRY_TIME_MAX_VALUE: number;
SMS_OTP_CODE_LENGTH_MAX_LENGTH: number;
SMS_OTP_CODE_LENGTH_MAX_VALUE: number;
SMS_OTP_CODE_LENGTH_MIN_LENGTH: number;
SMS_OTP_CODE_LENGTH_MIN_VALUE: number;
} = {

EXPIRY_TIME_MAX_LENGTH: 5,
EXPIRY_TIME_MAX_VALUE: 10080,
EXPIRY_TIME_MIN_LENGTH: 1,
EXPIRY_TIME_MIN_VALUE: 1
EXPIRY_TIME_MIN_VALUE: 1,
MAX_FAILED_ATTEMPT_COUNT_MAX_LENGTH: 2,
MAX_FAILED_ATTEMPT_COUNT_MAX_VALUE: 10,
MAX_FAILED_ATTEMPT_COUNT_MIN_LENGTH: 1,
MAX_FAILED_ATTEMPT_COUNT_MIN_VALUE: 1,
MAX_RESEND_COUNT_MAX_LENGTH: 1,
MAX_RESEND_COUNT_MAX_VALUE: 5,
MAX_RESEND_COUNT_MIN_LENGTH: 1,
MAX_RESEND_COUNT_MIN_VALUE: 1,
SMS_OTP_CODE_LENGTH_MAX_LENGTH: 2,
SMS_OTP_CODE_LENGTH_MAX_VALUE: 10,
SMS_OTP_CODE_LENGTH_MIN_LENGTH: 1,
SMS_OTP_CODE_LENGTH_MIN_VALUE: 6,
SMS_OTP_EXPIRY_TIME_MAX_LENGTH: 4,
SMS_OTP_EXPIRY_TIME_MAX_VALUE: 1440
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,20 @@ export class ServerConfigurationsConstants {
public static readonly PASSWORD_RECOVERY_QUESTION_FORCED_ENABLE: string =
"Recovery.Question.Password.Forced.Enable";

public static readonly RECOVERY_EMAIL_LINK_ENABLE: string = "Recovery.Notification.Password.emailLink.Enable";
public static readonly RECOVERY_SMS_OTP_ENABLE: string = "Recovery.Notification.Password.smsOtp.Enable";
public static readonly RECOVERY_OTP_USE_UPPERCASE: string =
"Recovery.Notification.Password.OTP.UseUppercaseCharactersInOTP";

public static readonly RECOVERY_OTP_USE_LOWERCASE: string =
"Recovery.Notification.Password.OTP.UseLowercaseCharactersInOTP";

public static readonly RECOVERY_OTP_USE_NUMERIC: string = "Recovery.Notification.Password.OTP.UseNumbersInOTP";
public static readonly RECOVERY_OTP_LENGTH: string = "Recovery.Notification.Password.OTP.OTPLength";
public static readonly RECOVERY_MAX_RESEND_COUNT: string = "Recovery.Notification.Password.MaxResendAttempts";
public static readonly RECOVERY_MAX_FAILED_ATTEMPTS_COUNT: string =
"Recovery.Notification.Password.MaxFailedAttempts";

/**
* Login policies - account locking API Keyword constants.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { AnalyticsConfigurationForm } from "./analytics-form";
import { AskPasswordForm } from "./ask-password";
import { LoginAttemptSecurityConfigurationFrom } from "./login-attempt-security-form";
import { MultiAttributeLoginForm } from "./multi-attribute-login";
import { PasswordRecoveryConfigurationForm } from "./password-recovery-form";
import { PasswordRecoveryConfigurationForm } from "./password-recovery-form/password-recovery-form";
import { SelfRegistrationForm } from "./self-registration-form";
import { UsernameRecoveryConfigurationForm } from "./username-recovery-form";
import { AppState, FeatureConfigInterface, history } from "../../admin.core.v1";
Expand Down
2 changes: 1 addition & 1 deletion features/admin.server-configurations.v1/forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

export * from "./connector-form-factory";
export * from "./login-attempt-security-form";
export * from "./password-recovery-form";
export * from "./password-recovery-form/password-recovery-form";
export * from "./self-registration-form";
Loading
Loading