:::: MENU ::::
Posts tagged with: admin user

Magento 2 get current admin user detail

Today we talk about how in Magento 2 get current admin user detail?. in this tutorial we will cover how to get current admin username and current admin email and other information included as well. So let’s start with our code example.

protected $authSession;

public function __construct(
    \Magento\Backend\Model\Auth\Session $authSession,
) {
    $this->authSession = $authSession;

public function getCurrentUser()
    return $this->authSession->getUser();

Now you have access to current admin information. You can get information with the following code.

$this->getCurrentUser->getUsername(); //get admin user name

$this->getCurrentUser->getEmail();   //get current admin email
Author: Qaisar Satti
Category: Magento 2
Last Modified: February 27, 2019

Magento 2 admin panel Unable to sign in or Account temporarily disabled

Today we will discuss about how you can solve the issue of magento 2 admin panel unable to sign in or account temporarily disabled. This mainly occurs due to secure functionality of magento 2. Magento 2 have introduced account disabled functionality keeping in mind the security of business. if you tried the wrong password repeatedly in admin panel login. Then you account got locked and temporary disabled. There are various methods to do so but we will discuss few here.

Lets have a look at the first method, in which you will learn to unlock and access the root folder

Unlock admin user

One can unlock the temporarily disabled account by going to Magento 2 root folder SSH and running the
the following command:

php bin/magento admin:user:unlock admin

There is another way of solving this problem but that might work for some and might not work for others. But is worth giving a try.

By resetting the username and password

For doing so do the following

sudo php bin/magento admin:user:create --admin-user="pearlbells" --admin-password="pear122l**all" --admin-email="pearl@gmail.com" --admin-firstname="Admin" --admin-lastname="Admin"

As i told you earlier there are many ways but we just discussed few simple and efficient methods.I Hope they will serve the purpose ad be useful.

Author: Qaisar Satti
Category: Magento 2
Last Modified: September 26, 2018