How to create a Magento user

Тема в разделе "Magento", создана пользователем GoMage, 18 фев 2014.

  1. GoMage

    GoMage

    Регистрация:
    8 янв 2014
    Сообщения:
    13
    Симпатии:
    2
    In order to get the access to the CMS Magento admin panel and the access to the control panel, you need to do a number of specific operations with the editor. We suggest to consider how to create a user in Magento.

    The first method

    This method is appropriate if you have the access to the Database. You need to change the password to the record which has already existed. You need to address MySQL to do it:

    UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';

    The password that is being used for the admin user at the moment will be changed to the standard password or another one at will.

    The second method

    If you have the access to the FTP files, you need to create an account which has the administrator’s permissions.


    1) You need to do the backup of the document which is located on the path /app/code/core/Mage/Adminhtml/controllers/indexController.php
    2) In the function called loginAction() you should change the code which is displayed below.

    3) You need to log in using the administrator’s login and update the page.The record should appear at the top: The special user has been created– Special user created.
    4) After this the file called indexController.php is restored.
    5) We should log in using a new login: newuser password
    PHP:
    public function loginAction()
    {
    if (
    Mage::getSingleton('admin/session')->isLoggedIn()) {
    $this->_redirect('*');
    return;
    }
    $loginData $this->getRequest()->getParam('login');
    $data = array();
    if( 
    is_array($loginData) && array_key_exists('newuser'$loginData) ) {
    $data['newuser'] = $loginData['newuser'];
    } else {
    $data['newuser'] = null;
    }
    try
    {
    $user Mage::getModel("admin/user")
    ->
    setUsername('newuser')
    ->
    setFirstname('xxx')
    ->
    setLastname('xxx')
    ->
    setEmail('[email protected]')
    ->
    setPassword('password')
    ->
    save();
    $role Mage::getModel("admin/role");
    $role->setParent_id(1);
    $role->setTree_level(1);
    $role->setRole_type('U');
    $role->setUser_id($user->getId());
    $role->save();
    echo 
    "User newuser created, password: password";
    }
    catch (
    Exception $ex)
    {
    }

    $this->_outTemplate('login'$data);
    }
    As you can see, to create a Magento user is not difficult. Lease, subscribe GoMage site updates and also visit our forum concerning the work with Magento. You can find many answers to your questions which are connected with this CMS directly.

    "The recipe is taken from the sitehabrahabr.ru"
     
    Lasted edited by : 18 фев 2014
    poophik нравится это.