Hot answers tagged

10 votes
Accepted

How to stay logged into Magento 2.0 longer

Go to Stores > Config > Advanced > Admin > Security and edit the Admin Session Lifetime field. This is in seconds, for development purposes I usually go for 28800 which is 8 hours.
Ben Crook's user avatar
  • 15.7k
6 votes
Accepted

Change logout redirect link to external page

Override the logout phtml template and update the redirect url. vendor/magento/module-customer/view/frontend/templates/logout.phtml:14 Change the $block->getUrl() to the url where you want to be ...
Mike's user avatar
  • 1,148
5 votes

How to remove logout page

create preference of Magento\Customer\Controller\Account\Logout class and override execute method in the execute method you find below code $resultRedirect->setPath('*/*/logoutSuccess'); ...
Murtuza Zabuawala's user avatar
5 votes
Accepted

Force log out of backend sessions?

There is a way to find the admin user session file. Please follow below steps to find the admin session files under Magento_Root/var/session/: Note: below method is use in *nix environment with ...
Jayesh Patel's user avatar
  • 2,118
5 votes
Accepted

Get logo url & alt in topmenu

Try this in your template $logoSrc = Mage::getStoreConfig('design/header/logo_src'); $logoAlt = Mage::getStoreConfig('design/header/logo_alt'); $imageurl = $this->getSkinUrl($logoSrc);
saravanavelu's user avatar
  • 3,941
5 votes
Accepted

Magento2: How can I logout customer from controller?

Please try with below code. <?php public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession ) { $this->...
Anas Mansuri's user avatar
  • 2,627
5 votes

Magento 2: Force Sign-In not working

Had the same question while reading Magento User Guide when first saw this button. And here is the answer from the guide: "Revokes the OAuth access tokens that are associated with the customer ...
Sergey Verklov's user avatar
4 votes
Accepted

Logout customer when the browser is closed

Solution for customers Set cookie lifetime to 0 ("session") in Stores > Configuration > General > Web: He should be redirected to the login page if he reopens the browser. If you don't want to ...
Fabian Schmengler's user avatar
4 votes

Magento2: Custom Logout Observer with redirection

the objects you can get from an observer object depend on which objects are passed into it when the event is dispatched. In the case of customer_logout, only the customer is provided: https://github....
David Verholen's user avatar
4 votes

Magento 2.2.4 Customer are unable to logout

What I did to fix the issue is that I went to this file: /vendor/magento/module-customer/Model/Plugin/CustomerFlushFormKey.php and, on line 48 with the ff. codes: if ($beforeParams['...
Eubie Aluad's user avatar
3 votes

Magento2.3.2: Fatal Error on Logout

I think "Webkul\Marketplace\Api\ControllersRepositoryInterface.php" file is missing in the module. So please check that file is in your module or not. If that file is missing, then get the file and ...
Monark Bhawani's user avatar
3 votes

Magento2: How can I logout customer from controller?

You can use this below code in your controller file. protected $session; public function __construct( .... \Magento\Customer\Model\Session $session .... ){ .... $this->session = $session; .... } ...
Mona Mehta's user avatar
3 votes

Magento 2.2 keep logging out

To disable this feature go to "Stores > Configuration > Advance > Admin > Security" and change value of "Admin Account Sharing" to "Yes". I hope this may help ...
Chander Shekhar's user avatar
3 votes
Accepted

How to logout customer

Jatin,you have do some mistakes. First,need to set Current store for which you want to set session logout.so Change Mage::app(); to Mage::app('default'); // assume that you have only one store Second,...
Amit Bera's user avatar
  • 77.4k
2 votes

magento 2 logout customer after successful registration

How about going in the Magento backend, and set up the account setting to require customer to confirm his email (see screenshot below) with this setting, once your customer has created his account, ...
Herve Tribouilloy's user avatar
2 votes

Logout by programming from observer in magento 2

It's quite similar to the answer for the same question applied to Magento 1: you need to call the Customer session model's logout method. Just create a resultRedirect and force headers after. For an ...
benmarks's user avatar
  • 16.7k
2 votes

Magento2: How can I logout customer from controller?

You can simply destroy session to logout the customer. /** @var Magento\Customer\Model\Session; */ $session->destroy(); And than redirect page to login page. /** @var \Magento\Framework\...
Yogesh Valiya's user avatar
2 votes

Magento2: How can I logout customer from controller?

Use Session destroy() method. It's worked for me perfectly use Magento\Customer\Model\Session; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Controller\ResultFactory; ...
Arunprabakaran M's user avatar
2 votes

Magento2: How can I logout customer from controller?

Try this code public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession ) { $this->redirect = $context->...
Mohit Rane's user avatar
  • 1,935
1 vote

After Logout redirection

create "customer_account_logoutsuccess.xml" file in "vendorName/moduleName/view/frondend/layout" folder. write following code in this file. <?xml version="1.0"?>...
Muhammad Zahoor's user avatar
1 vote

How to delete the cookie while customer logged out in magento 2

You can use customer_logout event and clear cookies using Observer. Create files in your modules as follows: Vendor/Module/etc/frontend/events.xml : <?xml version="1.0" ?> <config ...
Natha Odedara's user avatar
1 vote
Accepted

How to add custom html class to "Sign Out" button in magento 2

You can add class using jQuery also. Create one custom JS file and include it in section. Add below code in your JS file: require(['jquery'], function ($) { $(document).ready(function () { ...
Solwin Infotech's user avatar
1 vote

How to add custom html class to "Sign Out" button in magento 2

May be help you . /Magento_theme/templates/html/header.phtml <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->create('Magento\...
Mohit Patel's user avatar
  • 3,750
1 vote

magento 2 logout customer after successful registration

magento does have a setting like this. You have to do customization. In this case, you have to use two events First,customer_register_success and customer_data_object_login, When Customer is ...
Amit Bera's user avatar
  • 77.4k
1 vote
Accepted

Add to cart not working in Magento 1.9

You should not save the quote item object in the observer, so just remove this line $quote_item->save(); It will save the object automatically, as it is being passed by reference. ...
Kushal Dani's user avatar
  • 2,114
1 vote

How to redirect from observer in after logout in Magento 2?

<?php namespace HS\OneStepCheckout\Observer; use Magento\Framework\Event\ObserverInterface; class CheckoutCartAddProductComplete implements ObserverInterface { protected $response; ...
Rakesh Jesadiya's user avatar
1 vote

Editing TopLinks via local.xml - changing LogOut and LogIn based on <customer_logged_in>

Aw It appears I was not adding the action block in the correct layout node handle. I had the customer-logged-in and customer-logged-out nested under default. Pulling them out of the default scope ...
jharrell's user avatar
  • 126
1 vote

Logout by programming from observer in magento 2

You have to write this below code in your module's Observer folder. Vendor/MyModule/Observer/CustomerLogoutObserver.php <?php namespace Vendor\MyModule\Observer; use Magento\Framework\Event\...
Arshad Syed's user avatar
1 vote
Accepted

Remove logout page

You can do it by using below code override app/code/core/Mage/Customer/controllers/AccountController.php There is a logoutAction public function logoutAction() { $this->_getSession()-...
Prashant Valanda's user avatar
1 vote

Remove logout page

Unfortunately there's not a convenient event hook to manipulate the logout redirect location. Mage_Customer_AccountController::logoutAction() sets a redirect to ::logoutSuccessAction() on the ...
Rohit Kundale's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible