Skip to content

Commit 2124d13

Browse files
Kesari3008Shreyas281299
authored andcommitted
fix(meetings): more additions, tested captcha flow with different scenarios
1 parent 80a4531 commit 2124d13

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/components/WebexMeetingGuestAuthentication/WebexMeetingGuestAuthentication.jsx

+19-16
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function WebexMeetingGuestAuthentication({
5252
const [password, setPassword] = useState('');
5353
const [nameError, setNameError] = useState();
5454
const [captcha, setCaptcha] = useState('');
55-
const {ID, invalidPassword, requiredCaptcha} = useMeeting(meetingID);
55+
const {ID, failureReason, invalidPassword, requiredCaptcha} = useMeeting(meetingID);
5656
const [isJoining, setIsJoining] = useState(false);
5757
const adapter = useContext(AdapterContext);
5858
const ref = useRef();
@@ -62,18 +62,19 @@ export default function WebexMeetingGuestAuthentication({
6262
phone: width <= PHONE_LARGE,
6363
});
6464

65+
const passwordError = invalidPassword && failureReason === 'WRONG_PASSWORD' && !requiredCaptcha.captchaId ? 'Incorrect password. Try again.' : '';
66+
let captchaError = '';
67+
if (invalidPassword && failureReason === 'WRONG_PASSWORD' && requiredCaptcha.captchaId) {
68+
captchaError = 'Incorrect password entered too many times. Enter captcha code'
69+
} else if (failureReason === 'WRONG_CAPTCHA' && requiredCaptcha.captchaId) {
70+
captchaError = 'Invalid Captcha. Try again.'
71+
}
72+
6573
const isStartButtonDisabled = nameError || !password || invalidPassword || isJoining;
6674

6775
const joinMeeting = () => {
6876
setIsJoining(true);
69-
if (requiredCaptcha) {
70-
console.log('pkesari_joining meeting with password and captcha');
71-
adapter.meetingsAdapter.joinMeeting(ID, {name, password, captcha})
72-
.finally(() => setIsJoining(false));
73-
} else {
74-
console.log('pkesari_joining meeting with just password');
75-
adapter.meetingsAdapter.joinMeeting(ID, {name, password}).finally(() => setIsJoining(false));
76-
}
77+
adapter.meetingsAdapter.joinMeeting(ID, {name, password, captcha}).finally(() => setIsJoining(false));
7778
};
7879

7980
const handleNameChange = (value) => {
@@ -88,11 +89,12 @@ export default function WebexMeetingGuestAuthentication({
8889

8990
const handleCaptchaChange = (value) => {
9091
setCaptcha(value);
92+
adapter.meetingsAdapter.clearInvalidPasswordFlag(ID);
9193
};
9294

93-
// const refreshCaptcha = () => {
94-
// adapter.meetingsAdapter.refreshCaptcha();
95-
// };
95+
const refreshCaptcha = () => {
96+
adapter.meetingsAdapter.refreshCaptcha();
97+
};
9698

9799
const handleHostClick = (event) => {
98100
event.preventDefault();
@@ -127,21 +129,22 @@ export default function WebexMeetingGuestAuthentication({
127129
value={password}
128130
onChange={handlePasswordChange}
129131
disabled={isJoining}
130-
error={invalidPassword ? 'Incorrect password. Try again.' : ''}
132+
error={passwordError}
131133
label="Meeting password (required)"
132134
ariaLabel={HINTS.password}
133135
tabIndex={102}
134136
/>
135137
{requiredCaptcha && requiredCaptcha.verificationImageURL && (
136-
<div className={sc('captcha-image')} ariaLabel={HINTS.captchaImage}>
137-
<img src={requiredCaptcha.verificationImageURL} alt="captcha" hidden />
138+
<div className={sc('captcha-image')} aria-label={HINTS.captchaImage}>
139+
<img src={requiredCaptcha.verificationImageURL} alt="captcha" />
138140
<CaptchaInput
139141
className={sc('input')}
140142
type="captcha"
141143
name="captcha"
142144
value={captcha}
143145
onChange={handleCaptchaChange}
144-
label="Input Captcha"
146+
error={captchaError}
147+
label="Enter Captcha"
145148
ariaLabel={HINTS.captcha}
146149
tabIndex={103}
147150
/>

src/components/inputs/CaptchaInput/CaptchaInput.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default function CaptchaInput({
3434
pattern={pattern}
3535
placeholder={placeholder}
3636
required={required}
37-
rightIcon={value ? showCaptcha : false}
3837
style={style}
3938
tabIndex={tabIndex}
4039
value={value}

0 commit comments

Comments
 (0)