@@ -52,7 +52,7 @@ export default function WebexMeetingGuestAuthentication({
52
52
const [ password , setPassword ] = useState ( '' ) ;
53
53
const [ nameError , setNameError ] = useState ( ) ;
54
54
const [ captcha , setCaptcha ] = useState ( '' ) ;
55
- const { ID , invalidPassword, requiredCaptcha} = useMeeting ( meetingID ) ;
55
+ const { ID , failureReason , invalidPassword, requiredCaptcha} = useMeeting ( meetingID ) ;
56
56
const [ isJoining , setIsJoining ] = useState ( false ) ;
57
57
const adapter = useContext ( AdapterContext ) ;
58
58
const ref = useRef ( ) ;
@@ -62,18 +62,19 @@ export default function WebexMeetingGuestAuthentication({
62
62
phone : width <= PHONE_LARGE ,
63
63
} ) ;
64
64
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
+
65
73
const isStartButtonDisabled = nameError || ! password || invalidPassword || isJoining ;
66
74
67
75
const joinMeeting = ( ) => {
68
76
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 ) ) ;
77
78
} ;
78
79
79
80
const handleNameChange = ( value ) => {
@@ -88,11 +89,12 @@ export default function WebexMeetingGuestAuthentication({
88
89
89
90
const handleCaptchaChange = ( value ) => {
90
91
setCaptcha ( value ) ;
92
+ adapter . meetingsAdapter . clearInvalidPasswordFlag ( ID ) ;
91
93
} ;
92
94
93
- // const refreshCaptcha = () => {
94
- // adapter.meetingsAdapter.refreshCaptcha();
95
- // };
95
+ const refreshCaptcha = ( ) => {
96
+ adapter . meetingsAdapter . refreshCaptcha ( ) ;
97
+ } ;
96
98
97
99
const handleHostClick = ( event ) => {
98
100
event . preventDefault ( ) ;
@@ -127,21 +129,22 @@ export default function WebexMeetingGuestAuthentication({
127
129
value = { password }
128
130
onChange = { handlePasswordChange }
129
131
disabled = { isJoining }
130
- error = { invalidPassword ? 'Incorrect password. Try again.' : '' }
132
+ error = { passwordError }
131
133
label = "Meeting password (required)"
132
134
ariaLabel = { HINTS . password }
133
135
tabIndex = { 102 }
134
136
/>
135
137
{ 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" />
138
140
< CaptchaInput
139
141
className = { sc ( 'input' ) }
140
142
type = "captcha"
141
143
name = "captcha"
142
144
value = { captcha }
143
145
onChange = { handleCaptchaChange }
144
- label = "Input Captcha"
146
+ error = { captchaError }
147
+ label = "Enter Captcha"
145
148
ariaLabel = { HINTS . captcha }
146
149
tabIndex = { 103 }
147
150
/>
0 commit comments