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

Username recovery sms support #7005

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c36f03c
Add new web page.
Malith-19 Oct 2, 2024
6425c85
Add email or mobile field to username recovery page.
Malith-19 Oct 2, 2024
1884829
Add reources properties.
Malith-19 Oct 2, 2024
16126b1
Update the resource with new message content.
Malith-19 Oct 11, 2024
ce4a098
Integrate the notify with selected channel.
Malith-19 Oct 11, 2024
7ac3ed1
Update the resources for the DE.
Malith-19 Oct 14, 2024
765d8d1
remove the empty line.
Malith-19 Oct 14, 2024
053d70e
Improve the stylings.
Malith-19 Oct 14, 2024
d06f193
add config getting calls.
Malith-19 Oct 16, 2024
798540b
remove the tenantDomain get call.
Malith-19 Oct 18, 2024
601dd4e
Add email sms enable configs check.
Malith-19 Oct 18, 2024
058f5ba
🦋 Add changeset
Malith-19 Oct 18, 2024
37592ee
Update the comment.
Malith-19 Oct 18, 2024
5d35580
Update .changeset/six-singers-sing.md
Malith-19 Oct 21, 2024
7e9237b
Address the comments.
Malith-19 Oct 21, 2024
ca8b44b
Rename the form name in channel selection.
Malith-19 Oct 22, 2024
016fc3f
Update the js scripts.
Malith-19 Oct 22, 2024
f356f29
Update request get parameter with encoding.
Malith-19 Oct 22, 2024
851f59a
Update the success message for the username recovery.
Malith-19 Oct 22, 2024
6f03c72
Update the comment.
Malith-19 Oct 29, 2024
b0d1008
Remove the no valid user error catch block.
Malith-19 Oct 29, 2024
d836373
Update the comments.
Malith-19 Oct 29, 2024
bced779
Remove the unwanted boolean nochannelFound.
Malith-19 Oct 29, 2024
4e0278e
Refomat the code.
Malith-19 Oct 29, 2024
d739dbf
Format the code.
Malith-19 Oct 29, 2024
ccff022
Fix the formattings.
Malith-19 Oct 30, 2024
f75fc26
Add a placeholder for the contact input.
Malith-19 Nov 1, 2024
1602b3f
Encode the values in the input field.
Malith-19 Nov 1, 2024
a92062d
Read the regex from the claims for the validation.
Malith-19 Nov 2, 2024
150c0a6
Update the i18n string to support branding.
Malith-19 Nov 7, 2024
222588d
Imrove the formattings.
Malith-19 Nov 7, 2024
e4437d1
Remove the unused i18n string.
Malith-19 Nov 8, 2024
3178770
Add the branding support.
Malith-19 Nov 8, 2024
b400ad6
Merge branch 'master' into username-recovery-sms-support
Malith-19 Nov 8, 2024
36876a7
Update the branding screennames in username recovery pages.
Malith-19 Nov 8, 2024
825c12b
Update the changeset.
Malith-19 Nov 8, 2024
72270d6
Fix the indentation.
Malith-19 Nov 8, 2024
9930f13
Update the indentations.
Malith-19 Nov 8, 2024
594affc
Address the formatting suggestions.
Malith-19 Nov 8, 2024
7faeaa3
Add the page filetering in page drop down in branding.
Malith-19 Nov 12, 2024
d71e795
Reformat the code.
Malith-19 Nov 12, 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
8 changes: 8 additions & 0 deletions .changeset/fifty-lamps-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@wso2is/common.branding.v1": minor
"@wso2is/admin.branding.v1": minor
"@wso2is/identity-apps-core": minor
"@wso2is/i18n": minor
---

Add the username recovery multiple channel support with branding.
7 changes: 0 additions & 7 deletions .changeset/real-carpets-press.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ export const BrandingPreferencePreview: FunctionComponent<BrandingPreferencePrev
PreviewScreenType.TOTP,
PreviewScreenType.PASSWORD_RECOVERY,
PreviewScreenType.PASSWORD_RESET,
PreviewScreenType.PASSWORD_RESET_SUCCESS
PreviewScreenType.PASSWORD_RESET_SUCCESS,
PreviewScreenType.USERNAME_RECOVERY_CLAIM,
PreviewScreenType.USERNAME_RECOVERY_CHANNEL_SELECTION,
PreviewScreenType.USERNAME_RECOVERY_SUCCESS
];

const resolvePreviewScreen = (): ReactElement => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement } from "react";
import { CustomTextPreferenceConstants } from "../../../../constants/custom-text-preference-constants";
import useBrandingPreference from "../../../../hooks/use-branding-preference";

/**
* Proptypes for the username-recovery-channel-selection fragment of login screen skeleton.
*/
export type UsernameRecoveryChannelSelectionFragmentInterface = IdentifiableComponentInterface;

/**
* Usernam
Malith-19 marked this conversation as resolved.
Show resolved Hide resolved
* e recovery channel selection fragment component for the branding preview of Username Recovery box.
*
* @param props - Props injected to the component.
* @returns Username recovery fragment component.
*/
const UsernameRecoveryChannelSelectionFragment: FunctionComponent<UsernameRecoveryChannelSelectionFragmentInterface> = (
props: UsernameRecoveryChannelSelectionFragmentInterface
): ReactElement => {
const { ["data-componentid"]: componentId } = props;

const { i18n } = useBrandingPreference();

return (
<div data-componentid={ componentId }>
<h2>{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.HEADING, "Recovery Username") }
</h2>
<p>
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.BODY,
"Select a recovery option."
) }
</p>
<div className="ui divider hidden"></div>

<div className="segment-form">
<form className="ui large form" id="channelSelectionForm">
<div className="field">
<div className="ui radio checkbox">
<input type="radio" value="email" checked={ true } />
<label>{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.RADIO_BUTTON.EMAIL,
"Send Username via Email") }
</label>
</div>
</div>
<div className="field">
<div className="ui radio checkbox">
<input type="radio" value="sms" />
<label>{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.RADIO_BUTTON.SMS,
"Send Username via SMS") }
</label>
</div>
</div>

<div className="ui divider hidden"></div>

<div className="mt-4">
<button className="ui primary button large fluid" type="submit">
{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.BUTTON.NEXT, "Next") }
</button>
</div>

<div className="mt-1 align-center">
<a className="ui button secondary large fluid">
{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CHANNEL_SELECTION.BUTTON.CANCEL, "Cancel") }
</a>
</div>
</form>
</div>
</div>
);
};

/**
* Default proptypes for the component.
*/
UsernameRecoveryChannelSelectionFragment.defaultProps = {
"data-componentid": "username-recovery-channel-selection"
};
Malith-19 marked this conversation as resolved.
Show resolved Hide resolved

export default UsernameRecoveryChannelSelectionFragment;

Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement } from "react";
import { CustomTextPreferenceConstants } from "../../../../constants/custom-text-preference-constants";
import useBrandingPreference from "../../../../hooks/use-branding-preference";

/**
* Proptypes for the username-recovery-claims fragment of login screen skeleton.
*/
export type UsernameRecoveryClaimsFragmentInterface = IdentifiableComponentInterface;

/**
* Username recovery claim fragment component for the branding preview of Username Recovery box.
*
* @param props - Props injected to the component.
* @returns Username recovery fragment component.
*/
const UsernameRecoveryClaimsFragment: FunctionComponent<UsernameRecoveryClaimsFragmentInterface> = (
props: UsernameRecoveryClaimsFragmentInterface
): ReactElement => {
const { ["data-componentid"]: componentId } = props;

const { i18n } = useBrandingPreference();

return (
<div data-componentid={ componentId }>
<h2>
{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.HEADING, "Username Recovery") }
</h2>
<p>
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.BODY,
"Enter below details to recover your username."
) }
</p>

<div className="ui divider hidden"></div>
<div className="segment-form">
<form className="ui large form" method="post" id="recoverDetailsForm">
<div className="field">
<label>name</label>
<div className="two fields">
<div className="required field">
<input id="first-name" placeholder="First Name*" type="text" />
</div>
<div className="field">
<input id="last-name" placeholder="Last Name" type="text" />
</div>
</div>
</div>
<div className="required field">
<label>
{ i18n(
CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.IDENTIFIER.INPUT.LABEL,
"Email or mobile"
) }
</label>
<input
id="contact"
type="text"
placeholder={ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.IDENTIFIER.INPUT
.PLACEHOLDER,
"Email or mobile"
) }
/>
</div>
<div className="ui divider hidden"></div>
<div className="mt-0">
<button className="ui fluid large primary button" type="submit">
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.BUTTON.NEXT,
"Next"
) }
</button>
</div>
<div className="mt-1 align-center">
<a className="ui button secondary large fluid">
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_CLAIM.BUTTON.CANCEL,
"Cancel"
) }
</a>
</div>
</form>
</div>
</div>
);
};

/**
* Default proptypes for the component.
*/
UsernameRecoveryClaimsFragment.defaultProps = {
"data-componentid": "username-recovery-claims-fragment"
};

export default UsernameRecoveryClaimsFragment;
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { AppState } from "@wso2is/admin.core.v1/store";
import { BrandingPreferenceInterface } from "@wso2is/common.branding.v1/models";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement } from "react";
import { useSelector } from "react-redux";
import { CustomTextPreferenceConstants } from "../../../../../constants/custom-text-preference-constants";
import useBrandingPreference from "../../../../../hooks/use-branding-preference";

/**
* Proptypes for the username-recovery-success-email fragment of login screen skeleton.
*/
interface UsernameRecoverySuccessEmailFragmentInterface extends IdentifiableComponentInterface {
brandingPreference: BrandingPreferenceInterface;
}

/**
* Username recovery success email fragment component for the branding preview of Username Recovery box.
*
* @param props - Props injected to the component.
* @returns Username recovery fragment component.
*/
const UsernameRecoverySuccessEmailFragment: FunctionComponent<UsernameRecoverySuccessEmailFragmentInterface> = (
props: UsernameRecoverySuccessEmailFragmentInterface
): ReactElement => {
const { brandingPreference,
["data-componentid"]: componentId
} = props;
Malith-19 marked this conversation as resolved.
Show resolved Hide resolved

const { i18n } = useBrandingPreference();
const supportEmail: string = useSelector((state: AppState) => {
return state.config.deployment.extensions?.supportEmail as string;
});

return (
<div data-componentid={ componentId } className="ui green mt-3 attached">
<h3 className="ui header text-center slogan-message mt-4 mb-6" >{ i18n(CustomTextPreferenceConstants.
TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_SUCCESS_EMAIL.HEADING, "Check Your Email") }
</h3>
<p className="portal-tagline-description">
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_SUCCESS_EMAIL.BODY,
"Username recovery details have been sent to the email provided. If the email is not " +
"received,try again using different information."
) }
<br/>
<br/>
<br/>
<i className="caret left icon primary"/>
<a>
{ i18n(
CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.USERNAME_RECOVERY_SUCCESS_EMAIL.BUTTON,
"Back to application"
) }
</a>
<p className="ui portal-tagline-description">
For further assistance, write to
<br/>
<a>
<span className="orange-text-color button">
{ brandingPreference.organizationDetails.supportEmail || supportEmail }
</span>
</a>
</p>
</p>
</div>
);
};

/**
* Default proptypes for the component.
* See type definitions in interfaces.
*/
UsernameRecoverySuccessEmailFragment.defaultProps = {
"data-componentid": "username-recovery-success-email"
};

export default UsernameRecoverySuccessEmailFragment;
Loading
Loading