[GH-ISSUE #3001] 2fa button cannot be interacted with #2003

Closed
opened 2026-10-31 20:22:32 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @ckun52880 on GitHub (May 13, 2025).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3001

Describe the bug

Clicking the two-factor authentication button does not respond and interaction is unavailable

How to repeat the problem?

https://github.com/user-attachments/assets/7ef690cd-f2dc-46af-9637-8b1b39136ab4

Expected action

2fa is not working

Received action

2fa is not working

3x-ui Version

Version built on May 12, 2025 from the latest code on the main branch via GitHub Actions.

Xray-core Version

v25.4.30

Checklist

  • This bug report is written entirely in English.
  • This bug report is new and no one has reported it before me.
Originally created by @ckun52880 on GitHub (May 13, 2025). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3001 ### Describe the bug Clicking the two-factor authentication button does not respond and interaction is unavailable ### How to repeat the problem? https://github.com/user-attachments/assets/7ef690cd-f2dc-46af-9637-8b1b39136ab4 ### Expected action 2fa is not working ### Received action 2fa is not working ### 3x-ui Version Version built on May 12, 2025 from the latest code on the main branch via GitHub Actions. ### Xray-core Version v25.4.30 ### Checklist - [x] This bug report is written entirely in English. - [x] This bug report is new and no one has reported it before me.
bsakaguchi 2026-10-31 20:22:32 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sh1shd commented on GitHub (May 13, 2025):

Hello!

I cannot replicate this bug, two-factor authentication works correctly.

The test was done on a build based on the 7a5a833af3 commit, with a completely clean installation.

Demo

https://github.com/user-attachments/assets/2e0c327e-ec69-42ef-9330-6fcbbd9b8986

Perhaps the problem is solved by hard reloading the page with clearing the cache.

If the problem is not solved, you can tell me the browser version and logs from the console.

<!-- gh-comment-id:2875218161 --> @sh1shd commented on GitHub (May 13, 2025): Hello! I cannot replicate this bug, two-factor authentication works correctly. The test was done on a build based on the 7a5a833af3cd87222a8d8996ddfa0c6276514a3a commit, with a completely clean installation. <details><summary>Demo</summary> <p> https://github.com/user-attachments/assets/2e0c327e-ec69-42ef-9330-6fcbbd9b8986 </p> </details> Perhaps the problem is solved by hard reloading the page with clearing the cache. If the problem is not solved, you can tell me the browser version and logs from the console.
Author
Owner

@ckun52880 commented on GitHub (May 13, 2025):

error:
vue.min.js?2.5.8:6 TypeError: RandomUtil.randomBase32String is not a function
at Er.toggleTwoFactor (settings:1296:48)
at _n (vue.min.js?2.5.8:6:22257)
at a.r (vue.min.js?2.5.8:6:10679)
at _n (vue.min.js?2.5.8:6:22257)
at a.$emit (vue.min.js?2.5.8:6:44724)
at a.handleClick (antd.min.js:2:1221856)
at _n (vue.min.js?2.5.8:6:22257)
at HTMLButtonElement.r (vue.min.js?2.5.8:6:10679)
at HTMLButtonElement. (vue.min.js?2.5.8:6:59895)
$n @ vue.min.js?2.5.8:6
bn @ vue.min.js?2.5.8:6
yn @ vue.min.js?2.5.8:6
_n @ vue.min.js?2.5.8:6
r @ vue.min.js?2.5.8:6
_n @ vue.min.js?2.5.8:6
(匿名) @ vue.min.js?2.5.8:6
handleClick @ antd.min.js:2
_n @ vue.min.js?2.5.8:6
r @ vue.min.js?2.5.8:6
(匿名) @ vue.min.js?2.5.8:6

browser version:Microsoft Edge v136.0.3240.64

@shishkevichd

<!-- gh-comment-id:2875667431 --> @ckun52880 commented on GitHub (May 13, 2025): error: vue.min.js?2.5.8:6 TypeError: RandomUtil.randomBase32String is not a function at Er.toggleTwoFactor (settings:1296:48) at _n (vue.min.js?2.5.8:6:22257) at a.r (vue.min.js?2.5.8:6:10679) at _n (vue.min.js?2.5.8:6:22257) at a.$emit (vue.min.js?2.5.8:6:44724) at a.handleClick (antd.min.js:2:1221856) at _n (vue.min.js?2.5.8:6:22257) at HTMLButtonElement.r (vue.min.js?2.5.8:6:10679) at HTMLButtonElement.<anonymous> (vue.min.js?2.5.8:6:59895) $n @ vue.min.js?2.5.8:6 bn @ vue.min.js?2.5.8:6 yn @ vue.min.js?2.5.8:6 _n @ vue.min.js?2.5.8:6 r @ vue.min.js?2.5.8:6 _n @ vue.min.js?2.5.8:6 (匿名) @ vue.min.js?2.5.8:6 handleClick @ antd.min.js:2 _n @ vue.min.js?2.5.8:6 r @ vue.min.js?2.5.8:6 (匿名) @ vue.min.js?2.5.8:6 browser version:Microsoft Edge v136.0.3240.64 @shishkevichd
Author
Owner

@sh1shd commented on GitHub (May 13, 2025):

Have you tried a hard reload page with cache cleaning?

<!-- gh-comment-id:2875746941 --> @sh1shd commented on GitHub (May 13, 2025): Have you tried a hard reload page with cache cleaning?
Author
Owner

@ckun52880 commented on GitHub (May 13, 2025):

Hello, after using the cache clearing function to hard reload the page, I noticed that your operation was done under HTTP. I also tried it, and it indeed works for both HTTP and HTTPS, but it doesn't work when nginx is reverse proxying HTTPS.

<!-- gh-comment-id:2875857063 --> @ckun52880 commented on GitHub (May 13, 2025): Hello, after using the cache clearing function to hard reload the page, I noticed that your operation was done under HTTP. I also tried it, and it indeed works for both HTTP and HTTPS, but it doesn't work when nginx is reverse proxying HTTPS.
Author
Owner

@ckun52880 commented on GitHub (May 13, 2025):

I don't really understand.the following analysis of AI; I'm just a user.

The error occurred in assets/vue/vue.min.js?2.5.8

The following is a further explanation of this piece of code and the error:

function $n(t, e, n) {
    if (!q || typeof console === "undefined")
        throw t;
    console.error(t)   // The error occurred here.
}

And the complete stack reported by the console:

TypeError: RandomUtil.randomBase32String is not a function
    at Er.toggleTwoFactor (settings:1296:48)
    at _n (vue.min.js?2.5.8:6:22257)
    …(省略若干内部调用)

Here’s an English explanation you can share with your frontend team:


1. What That $n Function Is Doing

In Vue’s minified code, you’ll see an internal helper that looks like this:

function $n(error, vm, info) {
  if (!q || typeof console === 'undefined')
    throw error;
  console.error(error);
}
  • q is a compile-time flag:

    • Development build: q === true
    • Production build: q === false
  • In development (q === true)

    • !q is false, so Vue skips the throw and just logs the error with console.error(error).
    • The app continues running past the error.
  • In production (q === false)

    • !q is true, so Vue immediately does throw error.
    • This aborts the current call stack and prevents any further code in that event handler from running.

2. How This Relates to Your 2FA Button

  1. Root JavaScript Error

    TypeError: RandomUtil.randomBase32String is not a function
        at Er.toggleTwoFactor (settings:1296:48)
    
    • Your toggleTwoFactor method is calling RandomUtil.randomBase32String(), but that function doesn’t exist (or wasn’t imported), causing a TypeError.
  2. Development vs. Production Behavior

    • Development: Vue logs the TypeError to the console but continues, so your button still works (albeit with a warning).
    • Production: Vue immediately throws that TypeError via $n, stopping the click handler and making the button appear unresponsive.

3. Why It Worked When You Bypassed Nginx

  • Directly hitting your dev server served the development build of Vue (with q === true), which only logs and does not throw.
  • Going through Nginx served your production build (with q === false), which throws and halts execution.

  1. Restore or Export the Missing Function

    • Make sure RandomUtil.randomBase32String is correctly defined in your utility module and properly imported into the component.
  2. Add a Try/Catch Around the Call

    try {
      const code = RandomUtil.randomBase32String();
      // proceed with 2FA setup
    } catch (err) {
      console.error('2FA code generation failed', err);
      // show fallback UI or error message
    }
    
  3. Verify Build and Deployment Pipeline

    • Ensure that your CI/CD and Nginx configuration deploy the correct, up-to-date production bundle and that no old or truncated JS files are being served.

With this information, the frontend team can see that the unresponsive button is caused by a missing function in production combined with Vue’s production error-throwing behavior, rather than anything to do with Nginx.

thanks for sticking with this until the end

@shishkevichd

<!-- gh-comment-id:2875961570 --> @ckun52880 commented on GitHub (May 13, 2025): I don't really understand.the following analysis of AI; I'm just a user. The error occurred in assets/vue/vue.min.js?2.5.8 The following is a further explanation of this piece of code and the error: ```js function $n(t, e, n) { if (!q || typeof console === "undefined") throw t; console.error(t) // The error occurred here. } ``` And the complete stack reported by the console: ``` TypeError: RandomUtil.randomBase32String is not a function at Er.toggleTwoFactor (settings:1296:48) at _n (vue.min.js?2.5.8:6:22257) …(省略若干内部调用) ``` --- Here’s an English explanation you can share with your frontend team: --- ## 1. What That `$n` Function Is Doing In Vue’s minified code, you’ll see an internal helper that looks like this: ```js function $n(error, vm, info) { if (!q || typeof console === 'undefined') throw error; console.error(error); } ``` * `q` is a compile-time flag: * **Development build:** `q === true` * **Production build:** `q === false` * **In development (`q === true`)** * `!q` is `false`, so Vue skips the `throw` and just logs the error with `console.error(error)`. * The app continues running past the error. * **In production (`q === false`)** * `!q` is `true`, so Vue immediately does `throw error`. * This aborts the current call stack and prevents any further code in that event handler from running. --- ## 2. How This Relates to Your 2FA Button 1. **Root JavaScript Error** ```text TypeError: RandomUtil.randomBase32String is not a function at Er.toggleTwoFactor (settings:1296:48) ``` * Your `toggleTwoFactor` method is calling `RandomUtil.randomBase32String()`, but that function doesn’t exist (or wasn’t imported), causing a `TypeError`. 2. **Development vs. Production Behavior** * **Development:** Vue logs the `TypeError` to the console but continues, so your button still works (albeit with a warning). * **Production:** Vue immediately throws that `TypeError` via `$n`, stopping the click handler and making the button appear unresponsive. --- ## 3. Why It Worked When You Bypassed Nginx * Directly hitting your dev server served the **development build** of Vue (with `q === true`), which only logs and does not throw. * Going through Nginx served your **production build** (with `q === false`), which throws and halts execution. --- ## 4. Recommended Fixes 1. **Restore or Export the Missing Function** * Make sure `RandomUtil.randomBase32String` is correctly defined in your utility module and properly imported into the component. 2. **Add a Try/Catch Around the Call** ```js try { const code = RandomUtil.randomBase32String(); // proceed with 2FA setup } catch (err) { console.error('2FA code generation failed', err); // show fallback UI or error message } ``` 3. **Verify Build and Deployment Pipeline** * Ensure that your CI/CD and Nginx configuration deploy the correct, up-to-date production bundle and that no old or truncated JS files are being served. --- With this information, the frontend team can see that the unresponsive button is caused by a missing function in production combined with Vue’s production error-throwing behavior, rather than anything to do with Nginx. ### thanks for sticking with this until the end @shishkevichd
Author
Owner

@ckun52880 commented on GitHub (May 14, 2025):

Please analyze this. Thank you.
@shishkevichd @MHSanaei

<!-- gh-comment-id:2879557568 --> @ckun52880 commented on GitHub (May 14, 2025): Please analyze this. Thank you. @shishkevichd @MHSanaei
Author
Owner

@MHSanaei commented on GitHub (May 14, 2025):

there is no problem!!
try with another browser

<!-- gh-comment-id:2879919694 --> @MHSanaei commented on GitHub (May 14, 2025): there is no problem!! try with another browser
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#2003
No description provided.