News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Problem with Joomla login module and VM

Started by patbe60, November 18, 2022, 17:47:09 PM

Previous topic - Next topic

patbe60

As long as a user is in the shop menu (main page, category view, product view ...) he can't login or logout using the Joomla login module. This problem happens only with J4 (4.2.5).
He has to leave the shop and go to an other menu, so he can login or logout.

tested with J4.2.5, VM 4.0.7.10744, Cassiopeia template.

hazael

I use the latest version of VM and Joomla. I do not have such a problem.
Logging in to the site has nothing to do with the virtuemart component.
To log in, all you need is a regular form - nothing more. Make sure that nothing is missing from your form.
If your form uses Javascript check for javascript conflicts. Check URL in "action".

patbe60

Quote from: hazael on November 20, 2022, 11:38:24 AM
I use the latest version of VM and Joomla. I do not have such a problem.
Logging in to the site has nothing to do with the virtuemart component.
To log in, all you need is a regular form - nothing more. Make sure that nothing is missing from your form.
If your form uses Javascript check for javascript conflicts. Check URL in "action".
Believe me I know how to use either the login form as a menu item or the login module. I'm using Joomla since version 1.0.7.
It really doesn't work!

Today I made a fresh install of Joomla 4.2.5 and VM 4.0.8.10748.
As long as I am e.g. in detail view of an article, I can't login or logout with the Joomla login module. I have to leave the shop menu and go to the home menu. Then it works.

Everything works fine with Joomla 3.10.11 but not with Joomla 4.2.5!

hazael

Add the URL of your website here, because without it, each of us can only guess :)

patbe60

#4
testsite deleted

patbe60

It only works, when Search Engine Friendly URLs in the system configuration is off.

hazael

I logged in without a problem. It is exactly as I wrote. You have the wrong link in the form in action=""

In the form you have this:
<form id="login-form-16" class="mod-login" action="/test/index.php/shop/results,1-0" method="post" data-bitwarden-watching="1">
You should have this:
<form id="login-form-16" class="mod-login" action="/test/index.php" method="post" data-bitwarden-watching="1">

First, log in to the FTP to the root folder and change
https://www.ferbattu.ch/htaccess.txt
to:
https://www.ferbattu.ch/.htaccess

patbe60

#7
.htaccess is only necessary if you want to use url rewriting.

Please tell me how you could login with the user data I gave. I can't. I can login and logout, when I am in the shop menu (https://www.ferbattu.ch/test/index.php/shop). But I can't when I am in a category (choose one in the category module, e.g. https://www.ferbattu.ch/test/index.php/shop/headpiece) or in a details view of an article (choose e.g. Headpiece-> Cowboy hat)

You may login through the shop menu (select shop in the menu module). Then go to a category selected in the category module and try to logout. It will not work.

And btw. .htaccess already exists. If I would use URL Rewriting the URL would change to https://www.ferbattu.ch/test/shop. That's all and has nothing to do with the login.

And as I said it only works when "Search Engine Friendly URLs" in the Joomla configuration is off.

Normally when making a clean install of  Joomla Search Engine Friendly URLs is on. You may then also use URL rewriting. In this case it is necessary to change htaccess.txt into .htaccess.
And the login module works in every menu, no matter how the seo settings are except in the shop menu.

hazael

#8
Your template also doesn't have the essential <base href=""> tag in the <head> section

Generally, the whole problem is a non-existent part of your address: results,1-0  - Ugliest way to display SEF links I could imagine. ;-)
Remove this address fragment from your form and the problem should go away

If you run this address, I guarantee you will be logged in
https://www.ferbattu.ch/test/index.php/shop/

This is not a problem of Virtuemart and Joomla. It's just a problem with your links

patbe60

Quote from: hazael on November 23, 2022, 11:02:33 AM
Your template also doesn't have the essential <base href=""> tag in the <head> section

Generally, the whole problem is a non-existent part of your address: results,1-0  - Ugliest way to display SEF links I could imagine. ;-)
Remove this address fragment from your form and the problem should go away

If you run this address, I guarantee you will be logged in
https://www.ferbattu.ch/test/index.php/shop/

This is not a problem of Virtuemart and Joomla. It's just a problem with your links

I don't know whether you did read my posts seriously. I know, that I can login with this link. I did write this in my last post!!
But before you login go to a category or a detail view of an article and then try to login. It will not work. Or login first and then go to a category or directly to an article details view. You will not be able to logout.
That's the problem. And whats about the "ugliest way to display SEF links": that's not my problem, that's a VM problem. Sometimes this results,1-0 appears, sometimes it disappears. And also when it doesn't appear in category or details view the login module doesn't work. I know that a login is not possible, when it appears after ...index.php/shop/ (for the moment it doesn't appear)

And btw: it's not "my template" it's Cassiopeia, the default Joomla template.

And once again: It's a fresh Joomla install with a fresh VM install, no overrides, no other manipulation.

I hope someone of the dev team is reading this also and can replicate the problem.

hazael

#10
But this is the VM category page: https://www.ferbattu.ch/test/index.php/shop/  - and you can log in here

All forms work fine for me (login, search, ask about the product).

You can always repair your form in a simple way - in:
/modules/mod_login/tmpl/default.php

this
<form id="login-form-<?php echo $module->id; ?>" class="mod-login" action="<?php echo Route::_('index.php', true); ?>" method="post">
change to:
<form id="login-form-<?php echo $module->id; ?>" class="mod-login" action="/index.php" method="post">

It should work with your links. :)


patbe60

#11
unfortunately it doesn't work. With this change login is no more possible on any part of the website.

What I did this morning: Install J 3.10.11 and VM 4.0.8.10748. => Login worked everywhere also with "ugly" URLs.
Upgrade to Joomla 4.2.5. Login problem as described started.

hazael

#12
Because you have a page in a folder /test/ and you don't have a tag:

<head>
<base href="/test/" >
</head>

If you do not have this tag, enter the following in the form:

<form id="login-form-<?php echo $module->id; ?>" class="mod-login" action="/test/index.php" method="post">

Works 100% everywhere

In the default_logout.php form file, you should do the same

patbe60

Now it works. Thank you!!

I did also change in the default logout.php: <form class="mod-login-logout form-vertical" action="/test/index.php" method="post" id="login-form-<?php echo $module->id; ?>"> and logout works also everywhere.