()
| 146 | } |
| 147 | |
| 148 | function findOneTimeCodeLoginTrigger() { |
| 149 | const candidates = document.querySelectorAll( |
| 150 | 'button, a, [role="button"], [role="link"], input[type="button"], input[type="submit"]' |
| 151 | ); |
| 152 | |
| 153 | for (const el of candidates) { |
| 154 | if (!isVisibleElement(el)) continue; |
| 155 | if (el.disabled || el.getAttribute('aria-disabled') === 'true') continue; |
| 156 | |
| 157 | const text = [ |
| 158 | el.textContent, |
| 159 | el.value, |
| 160 | el.getAttribute('aria-label'), |
| 161 | el.getAttribute('title'), |
| 162 | ] |
| 163 | .filter(Boolean) |
| 164 | .join(' ') |
| 165 | .replace(/\s+/g, ' ') |
| 166 | .trim(); |
| 167 | |
| 168 | if (text && ONE_TIME_CODE_LOGIN_PATTERN.test(text)) { |
| 169 | return el; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | return null; |
| 174 | } |
| 175 | |
| 176 | function findResendVerificationCodeTrigger({ allowDisabled = false } = {}) { |
| 177 | const candidates = document.querySelectorAll( |
no test coverage detected