hryvinskyi / magento2-customer-sign-in-admin-ui
The Sign-in methods tab on the admin customer page: a customer's sign-in methods, and removing one or all of them for an admin allowed to manage them.
Package info
github.com/hryvinskyi/magento2-customer-sign-in-admin-ui
Type:magento2-module
pkg:composer/hryvinskyi/magento2-customer-sign-in-admin-ui
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-customer-sign-in: ^1.0
- hryvinskyi/magento2-customer-sign-in-api: ^1.0
- magento/framework: *
- magento/module-backend: *
- magento/module-customer: *
- magento/module-ui: *
Requires (Dev)
- magento/module-user: *
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The admin half of the customer sign-in suite. It adds a Sign-in methods tab to the customer page, which lists the customer's passkeys, authenticator app, phone and recovery codes, and lets a permitted admin remove one method or all of them. Use it when a customer has lost the phone or the device they finish signing in with and has no recovery code left.
What the admin sees
Open Customers > All Customers and edit a customer. The Sign-in methods tab lists each sign-in method of the customer, in the order they were added:
| Column | Shows |
|---|---|
| Method | The method's name, such as Passkey, Authenticator app or Text message. A method whose package was removed shows its code. |
| Name | The name the customer sees: a passkey's name, or a phone by its masked number. |
| Added | When it was added, in the admin's locale and the store's time zone. |
| Last Used | When it last finished a sign-in, or Never. |
| Action | Remove, for an admin who may manage sign-in methods. |
A customer with no method shows This customer signs in with their password alone. The tab is not shown while a new customer is being created.
Remove a sign-in method
- Click Remove in the row of the method.
- Confirm
Remove this sign-in method? When change notifications are on, the customer gets an email that a store administrator removed it.
The page reloads with The sign-in method was removed. When change notifications are on, the customer gets an email about it. Recovery codes have no Remove: they go with the customer's last passkey, authenticator app or phone. Removing that last one removes the codes too, and the customer then signs in with their password alone. An admin can remove it even while the store requires a second step from the customer's group; the customer then owes one, and the storefront sends them from My Account to Sign-in & Security until they add one.
Remove every sign-in method
- Click Remove all under the list.
- Confirm
Remove every sign-in method of this customer, the recovery codes included? The customer then signs in with their password alone. When change notifications are on, they get an email about each removed method.
The page reloads with Every sign-in method of the customer was removed. The customer now signs in with their password alone. When change notifications are on, they get an email about each removed method.
The email to the customer
The customer gets one email for each removed method, which says It was removed by a store administrator. The email goes out only while Email Customers About Changes (Stores > Settings > Configuration > Customers > Sign-in Methods > General) is Yes for the customer's store view. The confirmations and messages above name the email only as going out "when change notifications are on", which is this setting.
Messages
| Message | Cause |
|---|---|
This customer has no such sign-in method. It may have been removed already. |
The method was removed in the meantime, by the customer or another admin. |
Recovery codes go with the customer's last second-step method. They cannot be removed on their own. |
A request to remove only the recovery codes. |
We can't find the customer whose sign-in methods you want to remove. |
The request named no customer. The admin returns to the customer list. |
Permissions
Every role that opens the customer page sees the tab. The Remove and Remove all buttons show only to a role with Customers > All Customers > Manage customer sign-in methods in its Role Resources (System > Permissions > User Roles). The resource is declared by hryvinskyi/magento2-customer-sign-in (Hryvinskyi_CustomerSignIn::manage_factors), and both remove actions check it.
Configuration
None of its own. The sign-in methods' settings are under Stores > Settings > Configuration > Customers > Sign-in Methods, described in the README of each package.
Requirements
- Magento Open Source or Adobe Commerce 2.4.x. The suite is built and tested on 2.4.9.
- PHP 8.1 to 8.5.
hryvinskyi/magento2-customer-sign-in-api^1.0 andhryvinskyi/magento2-customer-sign-in^1.0.- The platform's Backend, Customer and Ui modules.
Installation
Run from the Magento root. hryvinskyi/magento2-customer-sign-in-pack installs this package with the rest of the suite.
composer require hryvinskyi/magento2-customer-sign-in-admin-ui bin/magento module:enable Hryvinskyi_Clock Hryvinskyi_RateLimit Hryvinskyi_VerificationCode Hryvinskyi_CustomerSignInApi Hryvinskyi_CustomerSignIn Hryvinskyi_CustomerSignInAdminUi bin/magento setup:upgrade bin/magento setup:di:compile # production mode only bin/magento setup:static-content:deploy -f # production mode only bin/magento cache:flush
Verify in the admin: open a customer under Customers > All Customers. The page has a Sign-in methods tab.
Registrations
| Where | What |
|---|---|
| Admin route | frontName customersignin: factor/remove (POST, customer_id and factor_id) and factor/removeAll (POST, customer_id), both ADMIN_RESOURCE Hryvinskyi_CustomerSignIn::manage_factors. Both return to customer/index/edit. |
| UI component | customer_form: an htmlContent with the block Block\Adminhtml\Customer\SignInMethodsTab and the template customer/sign_in_methods.phtml, rendered with the page. |
| Removal | FactorEnrolmentInterface::remove() and removeAll() with RemovalActor::Admin, which makes the customer's email say an administrator removed the method. |
The package registers no table, cron job, command, setting or ACL resource. It lists the methods of every package in the engine's method pool, so a new method shows in the tab with no change here.
Tests
Run from the Magento root.
- Unit:
vendor/bin/phpunit -c app/code/Hryvinskyi/CustomerSignInAdminUi/phpunit.xml.dist. - Integration: the platform's harness in
dev/tests/integration, against its own database, one run at a time.cd dev/tests/integration && php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../app/code/Hryvinskyi/CustomerSignInAdminUi/Test/Integration. - Static analysis: PHPStan 2.x at level 10 with the package's
phpstan.neon.dist(phpstan analyse -c app/code/Hryvinskyi/CustomerSignInAdminUi/phpstan.neon.dist --level=10) andvendor/bin/phpcs --standard=app/code/Hryvinskyi/CustomerSignInAdminUi/phpcs.xml.dist app/code/Hryvinskyi/CustomerSignInAdminUi.
Translations
The admin wording ships in en_US and 25 more locales: the official languages of the European Union, Norwegian Bokmål and Ukrainian. The translations are machine-made and no native speaker has read them. Have them checked before a store relies on them, and override a phrase in a theme or a language pack.