Skip to content

[5.x]: Non-admin users cant't create 2FA connection #16555

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

Closed
smnedelko opened this issue Jan 28, 2025 · 6 comments
Closed

[5.x]: Non-admin users cant't create 2FA connection #16555

smnedelko opened this issue Jan 28, 2025 · 6 comments
Labels

Comments

@smnedelko
Copy link

smnedelko commented Jan 28, 2025

What happened?

Description

If the user is not an administrator and has CP login rights, an error appears after scanning the 2FA QR and entering the code. Tested with Goggle Authenticator on Android and iPhone. For Android the QR code is modified as specified in #16552 (removed spaces from the url). The problem doesn't occur all the time.

Image

Steps to reproduce

  1. Enable 2FA authentication
  2. Create a non-administrator user using the CP or console
  3. Add CP login permissions for the user
Image
  1. Login to the created user account.
  2. Scan QR code with Google Authenticator app on iPhone. On Android modify the QR code as mentioned in [5.x]: Google Authenticator app shows dashes for 2FA (Two-Factor auth issue) #16552.
  3. Enter the code from the app.
  4. The error appears.

Expected behavior

The user should connect the 2FA code and login to the account.

Actual behavior

The permission denied error appears.

Craft CMS version

5.6.1

PHP version

8.2.26

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@smnedelko smnedelko added the bug label Jan 28, 2025
@i-just
Copy link
Contributor

i-just commented Jan 28, 2025

Hi, thanks for reaching out! Can you please post a stack trace for this error?

@Romanavr
Copy link

Romanavr commented Jan 30, 2025

Hi @i-just

I think there is a big misunderstanding because the translation for our customer language is wrong:

We came across this error when we tried to add TOTP. And since our website is in the Dutch language (NL), we thought from the error text that it had something to do with administrator rights.

However, after checking the code for the TOTP service, I found no reference to administrator rights. I checked the translation for the “elevated session” and found that it contains a text for the NL that means you have problems with your administrator rights.
Obviously the problem was in the elevated session and not with the administrator rights.

I would ask you to check this for the NL version, and it is probably worth doing this for other languages as well.

'This action may only be performed with an elevated session.' => 'Deze handeling mag alleen uitgevoerd worden als administrator.',

'This action may only be performed with an elevated session.' => 'Deze handeling mag alleen uitgevoerd worden als administrator.',

Image

@brandonkelly
Copy link
Member

@Romanavr Can you provide a better translation?

@Romanavr
Copy link

Romanavr commented Feb 1, 2025

@Romanavr Can you provide a better translation?

@brandonkelly

I asked my native Dutch-speaking colleague and he said that this option should be understandable:
"Deze actie kan alleen worden uitgevoerd met een elevated session."

Just in case, I checked it in my native language (RU) and everything looks good.
So, If it's not a big secret, how do you translate these phrases into other languages?
With the help of the community or with automatic tools like Google, DeepL, ChatGPT, etc.?

@brandonkelly
Copy link
Member

Thank you! I’ve updated the translation for the next release.

Translation work is primarily provided by Alconost, but the community can suggest better translations either here on GitHub or via CrowdIn (translate.craftcms.com).

@Romanavr
Copy link

Romanavr commented Feb 1, 2025

Thank you! I’ve updated the translation for the next release.

Translation work is primarily provided by Alconost, but the community can suggest better translations either here on GitHub or via CrowdIn (translate.craftcms.com).

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants