VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: rafipl on March 17, 2012, 19:58:54 PM

Title: account activation link problem
Post by: rafipl on March 17, 2012, 19:58:54 PM
UPDATE by Milbo: Should be fixed with http://forum.virtuemart.net/index.php?topic=122785.msg418993#msg418993


Here's last my topic  http://forum.virtuemart.net/index.php?topic=99735.0

I found half solution for this...
1. When user register from page http://mysite.com, he becomes activation link: http://mysite.com/index.php?option=com_users&task=registration.activate&token=xxxxxx - but it doesn't work (goes to index.php without any information)... but WHEN I correct link to http://WWW.mysite.com/index.php?option=com_users&task=registration.activate&token=xxxxxx so when I add "WWW" - all is ok and account is activated!
2.When user register from page http://www.mysite.com, he becomes activation link: http://www.mysite.com/index.php?option=com_users&task=registration.activate&token=xxxxxx - but it doesn't work (goes to index.php without any information)... but WHEN I correct link to http://mysite.com/index.php?option=com_users&task=registration.activate&token=xxxxxx so when I remove "WWW" - all is ok and account is activated!

what I should to do to repair it?
Title: Re: account activation link problem
Post by: bajobongo on April 07, 2012, 22:42:52 PM
I've got the same issue on my VM 2.02 + Joomla 2.5.4

I noticed that problem is somewhere in session mechanism (or cookies). When I clear all my cookies for webpage , then I can activate my account via activation link from e-mail. Otherwise this link redirect me to main page. That's way you can activate your accounts for other domain name - your browser treats it as different host and doesn't use the same cookies. It's probably joomla/VM bug or we have got something misconfigured.

Just after register a new user during checkout, this user is automatically logged in (without confirmation. Why?). His activation link won't never work until he is logged in (or cookie exist).

Someone can help us?
Title: Re: account activation link problem
Post by: jenkinhill on April 09, 2012, 11:01:08 AM
There is a known JUser issue in Joomla 2.5.3/4 which has been reported to the Joomla bug squad. This may be related to the problem you see.
Title: Re: account activation link problem
Post by: slammy on June 10, 2012, 22:29:58 PM
Hi,

I have the same issue. I am using joomla 2.5.4 and vm 2.0.7_d.

I didn´t test the registration until now because -normally - it´s such a easy thing.

I do not believe this is a problem related to joomla. The problem is like bajobongo said:
If you register, vm2 still logs the user in after sending the registration form. As long as this user is logged in, you cannot activate your account.
But what does this mean: This means the people will have to close all browser-instances after sending registration form and delete all temporarily internet files (cookies!!!) and then click the activation link.


Bounce rate will be very high. This is worse. This is a no-go. Does anyone have a solution for this?
Title: Re: account activation link problem
Post by: jenkinhill on June 10, 2012, 22:47:21 PM
I don't use email confirmation of registration, as the last thing I want during a sale is for a customer to wait for a confirmation email.

I have not tested this with 2.0.7d which is a development version, and not for use on a live site (although some do...)
Title: Re: account activation link problem
Post by: slammy on June 11, 2012, 12:17:02 PM
Hi Jenkinhill,

thx for ur post. Pls, i didn´t wanted to blame anyone with my last post. I was a little upset about myself that I didn´t test it earlier and of course I am on a test-envrionment and of course 2.0.7_d is a testversion.

You are right, normally it´s not good if the user have to wait for an account-confirmation email while making a order, but in some cases it´s required for securityreasons. We don´t have a adressdata confirmation with a external service, so its good to know that the person who is ordering is in property of the registered email-account. It´s something you can use if ppl try to betray u.

The only thing I was wondering was that if I have the possibilty to choose between free checkout as guest and account activation that last thing didn´t work.
Is account activation still a problem in the stable version releases like 2.0.4?

Last thing to make clear: VM2 is great, I use vm1.1.X since 4 years now. VM2 is the best I´ve ever seen, it has lots of improvements regarding payments, shipments, multilanguage, mulitvendor, SEO and on and on ...

Everyday I get more an more familar with it and I love it. You guys doing great work and I appreciate that, thank you.  ...

best regards
slam
Title: Re: account activation link problem
Post by: Bedrock on June 19, 2012, 15:30:53 PM
Not very elegantly, but I solved the problem.
First you have to put a script to the beginning of the "components/com_virtuemart/views/user/tmpl/edit_address_userfields.php" file.


<script language="javascript">
if ('<?php echo $_SERVER[HTTP_HOST]; ?>' == 'www.yourdomain.com')
{
location.href="http://yourdomain.com/yourregistrationpage" ;
}
</script>


This way it redirects the visitor if s/he arrived from a "www" domain to the registration page, so this way you cannot register from a "www" domain.

Then you have to modify the activation email's activation link that can be found in the "components/com_virtuemart/views/user/tmpl/mail_html_reguser.php"  file.

This has to be modified (53th row):

$activationLink = '<a class="default" href="' . JURI::root() . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


To this:

$modifiedlink = str_replace ("http://","http://www.",JURI::root());

$activationLink = '<a class="default" href="' . $modifiedlink . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


So the user will get a "www" activation link and with that the account can be activated.

best regards
bedrock
Title: Re: account activation link problem
Post by: mabeall32 on June 20, 2012, 18:36:42 PM
I having issues with the activation link.  but it works in ie9 and chrome, but not firefox.
Title: Re: account activation link problem
Post by: sukhrob on July 11, 2012, 13:40:05 PM
Quote from: Bedrock on June 19, 2012, 15:30:53 PM
Not very elegantly, but I solved the problem.
First you have to put a script to the beginning of the "components/com_virtuemart/views/user/tmpl/edit_address_userfields.php" file.


<script language="javascript">
if ('<?php echo $_SERVER[HTTP_HOST]; ?>' == 'www.yourdomain.com')
{
location.href="http://yourdomain.com/yourregistrationpage" ;
}
</script>


This way it redirects the visitor if s/he arrived from a "www" domain to the registration page, so this way you cannot register from a "www" domain.

Then you have to modify the activation email's activation link that can be found in the "components/com_virtuemart/views/user/tmpl/mail_html_reguser.php"  file.

This has to be modified (53th row):

$activationLink = '<a class="default" href="' . JURI::root() . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


To this:

$modifiedlink = str_replace ("http://","http://www.",JURI::root());

$activationLink = '<a class="default" href="' . $modifiedlink . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


So the user will get a "www" activation link and with that the account can be activated.

best regards
bedrock

Thank you Bedrock, your fix took care of the problem. Much appreciated.
Title: Re: account activation link problem
Post by: marcodelpercio on July 11, 2012, 23:19:48 PM
Hi,

I have the same problem however I am experiencing this only with Firefox (curious) moreover I have the same bug in localhost too where what you reported as workaround is not applicable.
I.e. on local VM 2.0.8c (Joomla 2.5.6) the website url is http://localhost.... if I register as a new user the activation link actually is http://localhost.... so it should be correct ...however that activation link doesn't work using Firefox. Same result if I click on it directly or use copy link location from context menu and paste the absolute URL directly in a firefox window.

It's very strange
Title: Re: account activation link problem
Post by: bonbin on July 13, 2012, 12:24:13 PM
this trick doesnt work for someone who use 301 for non www to www
does anyone have a solution for a site with 301 redireft non www to www ?
Title: Re: account activation link problem
Post by: Cotvi on August 11, 2012, 13:19:41 PM
anyone know how to do the opposite ?
www.domain.eu > domain.eu
for example:

http://domain.eu/index.php?option=com_users&task=registration.activate&token=a942112ddea534a486752a66ad770f65

because it does not work without www.

THX
Title: Re: account activation link problem
Post by: xarkitu on August 22, 2012, 19:36:09 PM
Quote from: Cotvi on August 11, 2012, 13:19:41 PM
anyone know how to do the opposite ?
www.domain.eu > domain.eu
for example:

http://domain.eu/index.php?option=com_users&task=registration.activate&token=a942112ddea534a486752a66ad770f65

because it does not work without www.

THX
Hi

On .htaccess include...

Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ yourdomain.com/$1 [R=301,L]

Title: Re: account activation link problem
Post by: Milbo on September 08, 2012, 16:57:12 PM
Atm I think it has something todo with alias, forwards and dns stuff.

I think configure www as alias is wrong. The www must be a forward to the non www URL
Title: Re: account activation link problem
Post by: bart198x on September 11, 2012, 12:43:50 PM
Is there any way (what to do) in VM 2.0.10 to register new user via VM registration form (with activation link) and make that user to be not logged in after registration (because I think that brake my activation link), maybe I'm wrong but I think that activation token is created and sent by email to user after register button is klicked, at the same time the new registered user is loging in and the activation token is destroyed - theoreticly is not needed for user, only for guests ?
So the things stays that user is logged but not activated, and having no chance to activate his account, because the link from mail is not readable.
I don't know where to search in php files.
Title: Re: account activation link problem
Post by: lipes on September 11, 2012, 22:11:20 PM
i've removed the activation link because i've only got problems with that emails with a link that never worked in activation ...
Now my site got 70% spam users and 30% normal users...
i cant find a solution to have a spam check in VM registration url ( index.php?option=com_virtuemart&view=user )... :-/
Title: Re: account activation link problem
Post by: mizu on September 14, 2012, 19:13:38 PM
I had the same activation link problem. It worked only when I manually added www to the activation link.
Finally did what Bedrock suggested. Not exactly nice, but efficient.

Thanks Bedrock!

@Milbo
"I think you make www as alias, that is wrong"
I don't get it. Can you please elaborate on this assumption?
Title: Re: account activation link problem
Post by: Jonhpoul on September 23, 2012, 17:26:18 PM
I'm using joomla 2.5.7 / VM2.0.10 all this tricks doesn't worked for me. I tried in crhome/ie/firefox with and without www but the result is all the same: verification code not found. I tried to do other things that I found in other forums until now unsuccessful. I consider this a serious issue in Virtuemart 2. When I was looking for how to fix it I noticed that since the beginer of the year people is talking about this, so, if anybody could help me, I appreciate.
Title: Re: account activation link problem
Post by: sahaldau on September 24, 2012, 11:57:08 AM
The solution provided gave me some problems and I made the following change. I did some tests and it works correctly

if(strpos(JURI::root(), 'http://www') === false){
   $modifiedlink = str_replace ("http://","http://www.",JURI::root());
}
Title: Re: account activation link problem
Post by: paping on September 26, 2012, 04:23:10 AM
PM me for solution.. i got it :)
Title: Re: account activation link problem
Post by: jopl12 on October 10, 2012, 10:22:42 AM
Hi but why you don't post the solution here?

Regards Jopl
Title: Re: account activation link problem
Post by: Giorgio34 on October 11, 2012, 22:09:47 PM
Hi,

I think problems come from virtuemart, here is why

After an user complete registration virtuemart automaticaly login this new user , even if you have set account confirmation.
Basically if the user ignores the message about activation, can move on to complete payment without activate account

I verify user status immediately after registration and surprise, JFactory::getUser()->guest return 1 and in the same time JFactory::getUser()->id return userid.
Also I verify user manager in admin area but there are no logged in users  :o
Virtuemart practically see the user is logged in, but sees not logged in Joomla

I do not think it's normal for Virtuemart to log a user whose account is not activated yet, so I think the problem is still somewhere in the Virtuemart files
Title: Re: account activation link problem
Post by: maxboy on October 13, 2012, 06:03:02 AM
Quote from: paping on September 26, 2012, 04:23:10 AM
PM me for solution.. i got it :)

Hi @paping, why don't you tell how much you want to get pay for sharing our fix? obviously that's what you want, otherwise, please share your fix, we will all thank you deeply.
Title: Re: account activation link problem
Post by: reggaebkk on October 26, 2012, 15:48:15 PM
I don't know if it's the right solution and still testing.
But after I read all the info above, I went into my cpanel/redirects and made a

301 forward
from http://(www.)?MyUrl.com/
to http://MyUrl.com
www redirection: only redirect with www
Wildcard redirect

And it seems to be working now... but I fear the day I will install https...
Title: Re: account activation link problem
Post by: reggaebkk on October 28, 2012, 13:31:23 PM
well... after having tested randomly while testing my overall website, it seems that sometimes it works, sometimes not... so I'm still in the vague.
Does anybody have the solution?
Title: Re: account activation link problem
Post by: ocean1 on November 05, 2012, 18:54:29 PM
So ... and now ... is there a solution?
When is the bug fixed?
I have the same problem
Title: Re: account activation link problem
Post by: DrZero on November 14, 2012, 06:24:28 AM
COME ON VIRTUEMART PROGRAMMERS!!!!  This is a Serious issue and needs solved NOW! 

We appreciate the fact you guys created such a thing and we all obviously like to use virtuemart, but please throw us a bone here.  If you're working on something at least tell us so, and if you have a workaround until an actual fix is in place, let us know. 

In attempting to do half of these workarounds we see on the forums....either they don't work for all versions or the user doesn't explain ALL locations to change the code.  Very very hard to follow if you're not a programmer.  So detail is important. 

Not trying to piss anyone off, but I know more than just me out there, are also frustrated.  Please take action and respond to our post!!
Title: Re: account activation link problem
Post by: Ffragrances on November 19, 2012, 07:45:20 AM
Quote from: Giorgio34 on October 11, 2012, 22:09:47 PM
Hi,

I think problems come from virtuemart, here is why

After an user complete registration virtuemart automaticaly login this new user , even if you have set account confirmation.
Basically if the user ignores the message about activation, can move on to complete payment without activate account

I verify user status immediately after registration and surprise, JFactory::getUser()->guest return 1 and in the same time JFactory::getUser()->id return userid.
Also I verify user manager in admin area but there are no logged in users  :o
Virtuemart practically see the user is logged in, but sees not logged in Joomla

I do not think it's normal for Virtuemart to log a user whose account is not activated yet, so I think the problem is still somewhere in the Virtuemart files

Yes everything else works fine in Joomla 2.5_. So this is in the VM code somewhere.. And I also feel that it has something to do with during the VM registration process, right after the user presses "register" they are taken  to a profile page and at the top are told that an email has been sent, yet just be;ow that it shows that they are logged in. But, they are not logged into Joomla. Only VM2. And if they go to the joomla login, of course being confused, they then get the error "Login Denied" Your account has either been blocked or you have not yet activated. Of course half the time no email was sent, and if you look in the back end of VM2 they are in fact blocked by default. So here we are ending the year soon and nothing.........Hmmmmmmm
Title: Re: account activation link problem
Post by: jack19 on November 21, 2012, 09:09:56 AM
Hi,
in .htaccess add (or to active) this rule
RewriteBase /
RewriteCond %{HTTP_HOST}   ^youdomain\.com [NC]
RewriteRule (.*) http://www.youdomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]


;)
Title: Re: account activation link problem
Post by: lipes on November 21, 2012, 16:03:44 PM
I've got a SPAM user, bot or something else, making 3 / 4 times by DAY registrations ...
And no solution to solve this because we dont have a captcha solution to apply in Virtuemart User Registration Form  :'(
Title: Re: account activation link problem
Post by: bart198x on December 02, 2012, 10:40:50 AM
for Lipes. That's why for registration I use joomla form with recaptcha. After proper registration the 'Registration' link changes to 'Your details' - directing not to registration but to edit_address_userfields.php where user can complete registration data :) little around but works. only one thing is annoyng me the TOS checkbox is not working correctly on edit_address_userfields.php (1. is not required actualy, 2. and does't display corectly it's value from data base - the state in DB is 1 but it's not checked in form for e.g.). If there is solution to TOS in edit_address_userfields.php please direct me on topic, after 2 days I still can't find it (I read a lot topics from forum with no solution, on cart I fixed TOS with one of them :) ).
Title: Re: account activation link problem
Post by: Makis77 on December 08, 2012, 01:06:34 AM
I m having the same issues as well.
Title: Re: account activation link problem
Post by: coruja on December 12, 2012, 08:23:05 AM
I am new to VM 2 and I have been trying to solve this issue for week or so.

The behaviour seems very erratic, it was not working at all (just re-directing me to the home page)  but when I added a .htaccess redirect from non-www to www it worked once or twice.
I am not sure if that was because  I had cleared down the cache and/or not 'logged in' to VM at the time.

I have then tried using KC VM Registration Redirect plug-in from the JED which did not seem to help. I have since uninstalled it.
However, I am now getting another another error "Registration failed: Verification code not found"

I am ready to try Bedrock's workaround but I am not sure what the '../yourregistrationpage' URL, as mentioned below, should be. Could someone please point me in the right direction?

Quote from: Bedrock on June 19, 2012, 15:30:53 PM
Not very elegantly, but I solved the problem.
First you have to put a script to the beginning of the "components/com_virtuemart/views/user/tmpl/edit_address_userfields.php" file.


<script language="javascript">
if ('<?php echo $_SERVER[HTTP_HOST]; ?>' == 'www.yourdomain.com')
{
location.href="http://yourdomain.com/yourregistrationpage" ;
}
</script>


This way it redirects the visitor if s/he arrived from a "www" domain to the registration page, so this way you cannot register from a "www" domain.

Then you have to modify the activation email's activation link that can be found in the "components/com_virtuemart/views/user/tmpl/mail_html_reguser.php"  file.

This has to be modified (53th row):

$activationLink = '<a class="default" href="' . JURI::root() . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


To this:

$modifiedlink = str_replace ("http://","http://www.",JURI::root());

$activationLink = '<a class="default" href="' . $modifiedlink . $this->activationLink . '">' . JText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';


So the user will get a "www" activation link and with that the account can be activated.

best regards
bedrock
Title: Re: account activation link problem
Post by: coruja on December 19, 2012, 04:29:30 AM
Hello,

I would really appreciate some help with my post above ^.  A lot of the solutions posted on VM forums seem to be targeted at experienced PHP developers hence novices to VM and PHP would struggle to understand them.
Title: Re: account activation link problem
Post by: Milbo on December 20, 2012, 17:40:07 PM
Good point bart198x, but we do that imho correct, controller user.php line 200

$usersConfig = JComponentHelper::getParams( 'com_users' );
$useractivation = $usersConfig->get( 'useractivation' );
if (is_array($ret) and $ret['success'] and !$useractivation) {
// Username and password must be passed in an array
$credentials = array('username' => $ret['user']->username,
  'password' => $ret['user']->password_clear
);
$return = $mainframe->login($credentials);
}


Maybe the $mainframe->login($credentials); is not working as expected. What we want to prevent is that user must login while the checkout.

Quote from: mizu on September 14, 2012, 19:13:38 PM
I had the same activation link problem. It worked only when I manually added www to the activation link.
Finally did what Bedrock suggested. Not exactly nice, but efficient.

Thanks Bedrock!

@Milbo
"I think you make www as alias, that is wrong"
I don't get it. Can you please elaborate on this assumption?

This is a server configuration issue. If you start to mix your domains. Most people have only a www domain or a domain without www. In fact the www is just a subdomain. so a www.domain.com exists almost always also as "domain.com". You can configurate the behaviour different. Imho the best solution is to use only with www or without www.

So if you can browse your page with or without www, without being redirected you may get in trouble. Imho this is the real problem behind it.

This is the reason we neglect this problem the last 3 months, because it is often a misconfigured server. Additionally to that it is usually not good to force shoppers todo a double optin.

Even someone pointed out that all other components work well, is the question how many components allow login? So it is strange to see that some people can just solve it changing joomla,  http://forum.virtuemart.net/index.php?topic=103992.msg373624#msg373624 .

Other users noticed also that they have the issue on some servers and on others not. So it is not clearly a Virtuemart problem
Title: Re: account activation link problem
Post by: tomh on January 03, 2013, 17:12:50 PM
What we found out today:

Virtuemart with the following settings enabled:
x Registration on checkout
x only registered users can checkout

Situation:

Ok, let's stop here.

Until here, everything is fine, but afterwards it's getting complicated...

Situation 1:


Situation 2:

Because of the change of the lastvisitDate, the joomla internal activation mechanisms don't work anymore. There's a check for a null-date in the SQL statement that gets executed when clicking the link. The activation code is stored in the user entry in the database.

So, joomla looks after the activation code together with a null-date and a user id. Activation code and user id do match, but the null-date does not.

Solutions:

Title: Re: account activation link problem
Post by: Milbo on January 04, 2013, 16:20:02 PM
Great written tomh,

But then this is a joomla problem from my point of view. Why they do this check?

and I just checked the code, we do

if($currentUser->guest==1){
$msg = (is_array($ret)) ? $ret['message'] : $ret;
$usersConfig = JComponentHelper::getParams( 'com_users' );
$useractivation = $usersConfig->get( 'useractivation' );
if (is_array($ret) and $ret['success'] and !$useractivation) {
// Username and password must be passed in an array
$credentials = array('username' => $ret['user']->username,
  'password' => $ret['user']->password_clear
);
$return = $mainframe->login($credentials);
}
}


So the user is only logged in if he is guest and if the useractivation is set to 0, none, nada, nix. GRmBL!
Title: Re: account activation link problem
Post by: dnlvsci on January 04, 2013, 22:08:08 PM
you are wrong milbo. this isn't joomla problem because: If you register in the cart or the index.php?option=com_virtuemart&view=user&layout=edit or the index.php?option=com_virtuemart&view=user&layout=editadress link you logged in automaticall by th VM. If you see the joomla login module that show you aren't logged in but if you go to the VM profile page (index.php?option=com_virtuemart&amp;view=user&amp;layout=default) this show you are logged in..... If you try to login in the normal joomla login module or link you can't because you ar in the joomla. After I returned on my profile page, logged out, but I cant login because I can't activate my account.

As tomh said -> the joomla wrote the last visite date and kill the activate method. If I revrite my last visit to 0000-00-00 00:00:00 I can activate my account.

I think if VM can be force logout me after the order thank mail sent, and can be revrite the last visit date 0000-00-00 00:00:00 (if block = 1 in the jos_users) the problem will be solve. This solve if you register in the cart, but not solve if you register in index.php?option=com_virtuemart&view=user&layout=edit/editadress page. The best solution if the Vm check user blocked and activation status and revrite the last login date if necessary
Title: Re: account activation link problem
Post by: Milbo on January 07, 2013, 01:31:39 AM
I wonder if you can read php. What I just said before is that we do this check. People should not be logged in IF there is a useractivation set. So the question is what is wrong in our code, which I posted above.

if (is_array($ret) and $ret['success'] and !$useractivation) {


I think atm the problem is maybe that we store the stuff and this is maybe writing another date in it. But still i do not really understand why joomla is performing this check, why is it necessary? There is any sense behind it?
Title: Re: account activation link problem
Post by: Milbo on January 07, 2013, 01:42:52 AM
I do not understand why it is logging in, there is only one place in the code and it was not called. However I set now in the usermodel line 625

$user->set('lastvisitDate', '0000-00-00 00:00:00');


Maybe it works, would be nice. At least this value is in the db, after I did the registration. Also funny that I see the correct messages from joomla, that I should check my email.
Title: Re: account activation link problem
Post by: dnlvsci on January 07, 2013, 14:39:20 PM
Not working. You send the 0000-00-00 00:00:00 date when you register, but joomla rewrite the date when you logged out from virtuemart profile page. If you don't logout, and you click the activation link you get a blank white page, if you logged out, and click the activation link you get error. I attached a picture to show you what happen. I bought something, registered in the cart, and after the order I go to my profile page....

[attachment cleanup by admin]
Title: Re: account activation link problem
Post by: Milbo on January 07, 2013, 20:32:49 PM
I know what you mean, but still we dont understand how it does the login.
Title: Re: account activation link problem
Post by: Milbo on January 07, 2013, 23:24:45 PM
Digged deeper into the problem

disable in /libraries/joomla/user.php the lines

if (empty($this->id))
{
$this->id = $table->get('id');
}


around line 814

The solution seems to use NOT the joomla method to store users which should activated.
Title: Re: account activation link problem
Post by: dnlvsci on January 08, 2013, 17:35:26 PM
Not a good solution. If I register, now I not logged in, but the activation link doesn't sent. If I try to register in cart, tha page say "Please register to checkout" or "User name in use" :(
Title: Re: account activation link problem
Post by: Milbo on January 08, 2013, 17:48:00 PM
It is not a solution, it should just show that as long we use joomla native save method, it is doing the error.
Title: Re: account activation link problem
Post by: dnlvsci on January 08, 2013, 18:02:41 PM
Yeah. I think this too. In VM1 wasn't problem the registration and the activation....
Title: Re: account activation link problem
Post by: jack19 on January 14, 2013, 15:12:14 PM
Hi to all,
in .htaccess add this rule


RewriteBase /
RewriteCond %{HTTP_HOST}   ^youdomain\.com [NC]
RewriteRule (.*) http://www.youdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
Title: Re: account activation link problem
Post by: matbeard on January 15, 2013, 13:52:31 PM
Quote from: jack19 on January 14, 2013, 15:12:14 PM
Hi to all,
in .htaccess add this rule


RewriteBase /
RewriteCond %{HTTP_HOST}   ^youdomain\.com [NC]
RewriteRule (.*) http://www.youdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]


This doesn't solve the problem.

Is there a definitive solution/workaround for this yet?

Cheers
Title: Re: account activation link problem
Post by: jamajlo on January 22, 2013, 19:45:05 PM
I found the solution. If user / admin has to activate the new account, user id is set to 0.

In administrator/components/com_virtuemar/models, line 682
add this:

if ($doUserActivation)
$user->set("id",'0');


It`s not the best solution, but it`s working.

The only one remaining problem is that VM is still showing address data for new registered user. Any ideas?
Title: Re: account activation link problem
Post by: skul2 on January 26, 2013, 16:18:33 PM
Hi there,

Am using VM 2.0.12 and joomla 2.57, when someone register on my my site and receive an activation link, after clicking the link they are not still activated. The strange thing is that when activate through a mobile phone it gets activated. I have tried different browser, still the same problem. Any assistant will be appreciated.

Best regard
Skul2
Title: Re: account activation link problem
Post by: tikhonov on January 27, 2013, 16:39:58 PM
Hi!

From my experience, the problem is related to the session that VM2 establishes in the browser. So, if at the same time  the same shopper try to activate his account, Joomla! refuses, since Joomla! considers him as being logged in. Note that when the session expires, e.g. clear cache, or if we use a different browser, e.g. mobile browser, the shopper is able to activate his account.

In my setup I have commented lines 34-37 of the activate() public function of components\com_users\controllers\registration.php file.
// If the user is logged in, return them back to the homepage.
/*if ($user->get('id')) {
$this->setRedirect('index.php');
return true;
}*/

Certainly, the above is not the optimum solution, since although a customer is able to activate, he is not able to log in before the session expire.  (Note also that in my setup I always redirect www links to non-www ones, through the .htaccess file)

The VM2 - Joomla! conflict is a critical issue that VM2 developers should address in future versions, since this inconsistency degrades the confidence of a potential shopper to the e-shop. This is really unfair for VM2, since in fact, it is a great component!

As mentioned before, all the above is what I have realized from my experience with the problem. So, if there is anything more, that a website administrator can do to avoid the problem, I would kindly suggest the VM2 developers to give some specific advices and explanations.

Thanks,
Nikos

Joomla! 2.5.8
VM 2.0.18a
Title: Re: account activation link problem
Post by: iwoh on January 28, 2013, 10:10:53 AM
I wan't to remove the activation link from the e-mail user receives after registration. Wher can I do it? My Joomla 2.5.8, Virtuemart 2.0.18a
Title: Re: account activation link problem
Post by: skul2 on February 03, 2013, 16:14:29 PM
Hi guys,

All I did was to follow above instructions by  tikhonov and it work great for me, so will advice you to do the same, very simple.

Good luck.
Title: Re: account activation link problem
Post by: jenkinhill on February 03, 2013, 18:51:35 PM
@iwoh I don't believe any shop should require account activation, this is easy to set in Joomla. See http://forum.virtuemart.net/index.php?topic=112548.msg378905#msg378905
Title: Re: account activation link problem
Post by: broll on February 05, 2013, 14:43:08 PM
Quote from: jenkinhill on February 03, 2013, 18:51:35 PM
@iwoh I don't believe any shop should require account activation, this is easy to set in Joomla. See http://forum.virtuemart.net/index.php?topic=112548.msg378905#msg378905

I'm sorry, I simply do not agree.

I am currently struggling with a B2B wholesale site on this very issue. The end client wishes to be able to manually activate accounts after vetting his customers.

An automatic registration, or the lack of such account activation would merely serve their wholesale prices to the general web public. This would, of course, be of no use to their wholesale business at all.

Without a solution I will be forced to use alternative cart software and move away from Joomla altogether.

Please do not read this as a direct criticism of the hard work done to bring VM2 to the market, for straightforward single priced items I cannot fault it. However, for any site requiring multiple prices or admin control over account activation I am forced to use an alternative.
Title: Re: account activation link problem
Post by: jenkinhill on February 06, 2013, 23:53:15 PM
broll, "The end client wishes to be able to manually activate accounts after vetting his customers." I have done a couple of those for a large furniture wholesaler's website and intranet. This is not a normal retail "shop".

There I use Allow User Registration = Yes and  New User Account Activation = Admin.
On receiving the registration email the storeadmin logs into the site,  double checks their address etc and VAT number, sets the shopper group of the user and  enables/activates them in the Joomla user manager, then mails them a one time discount coupon (ie inviting them back to buy). The last site I did had 5 different prices for users depending on their shopper group. This is now so easy to set up in VM2.0.18a
Title: Re: account activation link problem
Post by: werian on March 10, 2013, 15:29:30 PM
Hello there,

check my solution based on .htaccess & plugin written by myself - http://forum.virtuemart.net/index.php?topic=113802.0 .
Title: Re: account activation link problem
Post by: templeton on May 09, 2013, 23:06:37 PM
This is much simpler:

1)  Comment out the following lines in components/com_users/controllers/registration.php (line 34 for me):

      if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }

So like this:

      /*if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }*/


2) Modify the following line of code in components/com_users/models/registration.php (line 47 for me):

         ' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())

So like this:

         '' //' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())


It's a Joomla com_users hack but it's pretty simple to execute.
Title: Re: account activation link problem
Post by: Stonedfury on May 10, 2013, 17:59:55 PM
Quote from: werian on March 10, 2013, 15:29:30 PM
Hello there,

check my solution based on .htaccess & plugin written by myself - http://forum.virtuemart.net/index.php?topic=113802.0 .

Perfect fix. No hack not muss and no fuss. Thank you sir. Maybe VM will get this implemented
Title: Re: account activation link problem
Post by: Daroch on May 29, 2013, 13:18:47 PM
Thank you very much, templeton.
A geat solution in a large post...   ;)
Title: Re: account activation link problem
Post by: thealmega on June 26, 2013, 01:36:16 AM
hi,

i think the problem is that virtuemart uses the current user object and doesnt create a new one

//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = ($this->_id < 1);
if(empty($this->_id)){
//$user = JFactory::getUser();
$user = new JUser;
} else {
$user = JFactory::getUser($this->_id);
}


this fixed the problem for me
Title: Re: account activation link problem
Post by: Milbo on August 10, 2013, 15:42:30 PM
Thank you, sounds valid added to the core. Lets test it.
Title: Re: account activation link problem
Post by: nascent on August 16, 2013, 12:56:45 PM
Hi thealmega,
Where is this code supposed to go?
I would like to test it on my site.

cheers,
n
Title: Re: account activation link problem
Post by: Maxim Pishnyak on August 16, 2013, 19:40:25 PM
com_virtuemart.2.0.22\administrator\components\com_virtuemart\models\user.php
Title: Re: account activation link problem
Post by: nascent on August 17, 2013, 14:05:48 PM
Thanks Maxim :)
Title: Re: account activation link problem
Post by: ufo_hk on August 19, 2013, 07:00:56 AM
Hi,

for Joomla 2.5.14 VM 2.0.20b I applied fix as per thealmega's post and it resolved the registration problem I was having.

For others who are looking to test /use.
File is for above VM version: administrator\components\com_virtuemart\models\user.php

Line where edit starts: 490

Cheers
Title: Re: account activation link problem
Post by: fastpat27 on September 07, 2013, 18:50:59 PM
Quote from: templeton on May 09, 2013, 23:06:37 PM
This is much simpler:

1)  Comment out the following lines in components/com_users/controllers/registration.php (line 34 for me):

      if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }

So like this:

      /*if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }*/


2) Modify the following line of code in components/com_users/models/registration.php (line 47 for me):

         ' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())

So like this:

         '' //' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())


It's a Joomla com_users hack but it's pretty simple to execute.

Seems to have worked for me, Thanks Templeton

FP

Edit: Just one question, will this need to be done if Joomla or Virtuemart is updated to newer versions?? Currently on Joomla 2.5.14 and VM 2.0.22a
Title: Re: account activation link problem
Post by: rauschr on September 25, 2013, 13:27:56 PM
Quote from: fastpat27 on September 07, 2013, 18:50:59 PM
Quote from: templeton on May 09, 2013, 23:06:37 PM
This is much simpler:

1)  Comment out the following lines in components/com_users/controllers/registration.php (line 34 for me):

      if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }

So like this:

      /*if ($user->get('id')) {
         $this->setRedirect('index.php');
         return true;
      }*/


2) Modify the following line of code in components/com_users/models/registration.php (line 47 for me):

         ' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())

So like this:

         '' //' AND '.$db->quoteName('lastvisitDate').' = '.$db->Quote($db->getNullDate())


It's a Joomla com_users hack but it's pretty simple to execute.

Seems to have worked for me, Thanks Templeton

FP

Edit: Just one question, will this need to be done if Joomla or Virtuemart is updated to newer versions?? Currently on Joomla 2.5.14 and VM 2.0.22a

This is wrong way !
I think, it should not login without active users.
It is very big security problem.
Title: Re: account activation link problem
Post by: serhiox on October 17, 2013, 14:24:51 PM
thealmega, Maxim Pishnyak> thanks guys, it works.  :) (2 days suffering) Спасибо Максим! 8)
Title: Re: account activation link problem
Post by: kok on November 18, 2013, 15:55:46 PM
Help, killed a few hours so not solved the problem.
Activation link not worked :-(
Activation link: http://www.softex.it-klub.ru/index.php?option=com_users&task=registration.activate&token=bfd01e78d58d4b85f78746a04040dc94 ,
but output error message "Warning    Registration failed: Verification code not found."

Ну просто жесть :-(
Столько времени убил, а активация так и не работает.
Title: Re: account activation link problem
Post by: kok on November 19, 2013, 06:04:54 AM
Why is "out of the box" does not work for activation user by e-mail?
This is the is basic functionality!
On a clean system will work or not?
Why is www and non-www hemorrhoids?

I was caught on a hook with this VM :-(
Title: Re: account activation link problem
Post by: thanili on December 09, 2013, 13:28:40 PM
Quote from: thealmega on June 26, 2013, 01:36:16 AM
hi,

i think the problem is that virtuemart uses the current user object and doesnt create a new one

//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = ($this->_id < 1);
if(empty($this->_id)){
//$user = JFactory::getUser();
$user = new JUser;
} else {
$user = JFactory::getUser($this->_id);
}


this fixed the problem for me

This is the best solutions proposed and actually it is working. However there is a small "bug" in the flow. If the user tries to checkout without first having logged in then:

a) he fills his registration data
b) selects the button "Register & Checkout"
c)  check in the backend and found that his account IS NOT activated
d) he checks out succesfully (without loggin in)
e) the email sent to him includes a working link ... BUT the message he gets is "Registration failed: Verification code not found."

i assume that in step (e) the link is working because when i clicked on it, it Activated user's account!!
Title: Re: account activation link problem
Post by: vixensjlin on December 20, 2013, 09:00:59 AM
Still have this issue with 2.026.  So we still don't have it fixed?  On top of it, I am using https when user start register......
Hopefully we will get it fixed in the next revision.

Everybody have nice holiday!
Title: Re: account activation link problem
Post by: eag on December 26, 2013, 19:41:10 PM
When this change will be included in future updates?

With each update you have to re-edit the core to work the registration process correctly when activation by the customer is required.
Title: Re: account activation link problem
Post by: Renata on January 07, 2014, 14:26:36 PM
Same issue here. I am using Joomla 2.5.17 and VM 2.0.26a

url: http://www.wingsofchange.nl/webwinkel

I see a lot of solutions here to add some script, but imho this is not the solution. Eacht time there is an update (which happens a lot) you have to add the script again. I hope the team of Virtuemart will come with a solution asap?

I hope to hear from you soon,

Kind regards
Renata
Title: Re: account activation link problem
Post by: syntalk on January 20, 2014, 11:17:02 AM
Quote from: thealmega on June 26, 2013, 01:36:16 AM
//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = ($this->_id < 1);
if(empty($this->_id)){
//$user = JFactory::getUser();
$user = new JUser;
} else {
$user = JFactory::getUser($this->_id);
}


Looks like this is a part of the VM now, correct?

None of this is working for me, my www redirection is fine. I also tried werian's plugin but no joy. I'm logged in before I activate the account, when I click on activation links site goes to HomePage, when I logout before click on the link it says "Registration failed: Verification code not found."

Would be very grateful for any solution.
Title: Re: account activation link problem
Post by: keep on January 20, 2014, 19:03:36 PM
I think the problem is somewhere around the JUser object.
I fill the registration form, I send it. The user is created but it is inactive. My activation link looks like this:
http://mydomain/index.php?option=com_users&task=registration.activate&token=7d2d465698571b0416fd7ff1e266766b
If I check the activate() method in UsersControllerRegistration class (components/com_users/controllers/registration.php), there is a code:
if ($user->get('id')) {
$this->setRedirect('index.php');
return true;
}

That's ok because you don't want to activate a user who is logged in. But check the $user object. This is filled with my new user's data, there is a username and id too but the guest param is 1.
The correct check is maybe !$user->get('guest']) instead $user->get('id')
So this is a VirtueMart problem with the JUser object or a Joomla problem during the activation? Basically is there a valid situation when the guest user has an id?
And if you change your domain with www, the JUser object is empty because you changed your session too with your domain.
Title: Re: account activation link problem
Post by: Milbo on January 21, 2014, 00:52:46 AM
Quote from: eag on December 26, 2013, 19:41:10 PM
When this change will be included in future updates?

With each update you have to re-edit the core to work the registration process correctly when activation by the customer is required.

Which change do you use, which is not in the core? thealmega fix is in the core.


Quote from: keep on January 20, 2014, 19:03:36 PM
The correct check is maybe !$user->get('guest']) instead $user->get('id')


What do you propose?
Title: Re: account activation link problem
Post by: eag on January 21, 2014, 01:00:52 AM
Hi Milbo,

Quote from: Milbo on January 21, 2014, 00:52:46 AM
Quote from: eag on December 26, 2013, 19:41:10 PM
When this change will be included in future updates?

With each update you have to re-edit the core to work the registration process correctly when activation by the customer is required.
Which change do you use, which is not in the core? thealmega fix is in the core.

This thealmega fix:
//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = ($this->_id < 1);
if(empty($this->_id)){
//$user = JFactory::getUser();
$user = new JUser;
} else {
$user = JFactory::getUser($this->_id);
}


Actually (VM 2.0.26d) in administrator/components/com_virtuemart/models/user.php doesn't exist this fix. In line 499:
//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = ($this->_id < 1);
if(empty($this->_id)){
$user = JFactory::getUser();
} else {
$user = JFactory::getUser($this->_id);
}


thanks
Title: Re: account activation link problem
Post by: Milbo on January 29, 2014, 19:42:44 PM
Okey, then I missed that, i am sorry, I will recheck,

meanwhile another user found for another problem this. but maybe it works here also

Quote from: Muszti on January 24, 2014, 15:11:24 PM
For me it was the same problem: add to cart button fancybox did not work.
tried my page with http://www.hermex.hu, then tried http://hermex.hu
One of them was working well with the add to cart popup, other didn't.

It turned out that in configuration php it was a setting for live site either one link with www or without it.

I just cleared out that setting in configuration.php like this:
public $live_site = '';

And now both way of domain name works correctly.
Title: Re: account activation link problem
Post by: Renata on January 30, 2014, 00:39:49 AM
Dear Milbo

All my website have: public $live_site = '';

And i have the same problem. I turned activation off now in order to solve this problem, but this is not the solution, just a temporarely fix.

Kind regards
Renata
Title: Re: account activation link problem
Post by: Sitestorm on February 05, 2014, 15:02:16 PM
I have this same issue: http://forum.virtuemart.net/index.php?topic=121825.msg416510#msg416510

In short: virtuemart should not log in a user if activation is required.
Title: Re: account activation link problem
Post by: keep on February 14, 2014, 12:37:17 PM
Thealmega fix is in the 2.0.27 version :) Thanks
Title: Re: account activation link problem
Post by: Renata on February 19, 2014, 09:30:46 AM
Thanks i hope so!

Major problem on all my websites. Activation link doesn't work and user is already logged in indead.

Looking forward to the next release.

Kind regards
Renata
Title: Re: account activation link problem
Post by: Milbo on March 07, 2014, 21:32:15 PM
Please test this one http://dev.virtuemart.net/attachments/download/689/com_virtuemart.2.5.2_extract_first.zip

It was planned as 2.0.28, so you can install it over your version, should be completly backward compatible. It has also a captcha now, maybe the avoids the problem anyway. It has some more enhancements for being logged in directly after registration. Please test it.
Title: Re: account activation link problem
Post by: Mathalis on March 18, 2014, 09:27:38 AM
Hello,
Thanks

Does it mean the next release 2.028 'll have this fix ?
When does it plan ?
Title: Re: account activation link problem
Post by: Milbo on March 18, 2014, 22:24:45 PM
There wont be a vm2.0.28, it will be vm2.6 and the RC is released as vm2.5.4 also with fullinstaller. Please read here http://forum.virtuemart.net/index.php?topic=122785.msg418993#msg418993
Title: Re: account activation link problem
Post by: escozul on April 22, 2014, 12:37:56 PM
After updating to v 2.6.0 of virtuemart I keep getting the message:
Username and password do not match or you do not have an account yet

That happens for every new user that tries to sign up at the site
Old users connect without a problem
I verified that the thealmega patch is implemented with the new version however still no way to register a new user. Up to version 2.0.26d the registration system was working when I added the thealmega patch. Now that won't work although thealmega patch is implemented into the core of virtuemart.

Also, to note that I do not use "self" or "administrator" activation methods. When using "self" the activation link doesn't work and new users can't ever activate. That simply doesn't work and was not working with 2.0.26d so I simply added captcha and have them automaticaly activate. So even with automatic activation (when checking on back end the user is activated and enabled) I keep getting that message that username and password do not match. That of course is not the case since the passwords I use are simple and use copy and paste to do the testing.

I really need some help please.
Title: Re: account activation link problem
Post by: velikorodnov on April 22, 2014, 22:30:23 PM
Hello, developers. I found a big bug. Activation link doesn't work after registration. I tested
VirtueMart2.6.0_Joomla_2.5.19-Stable-Full_Package.zip
Could you check this
Title: Re: account activation link problem
Post by: escozul on April 22, 2014, 23:10:03 PM
I confirm what velikorodnov is reporting.


The already existing users are not affected but it is impossible to create any new users.

Thank you

Update: It seems that downgrading Joomla from 2.5.19 to 2.5.17 makes the issue go away. I guess that can help with debugging the issue.
Title: Re: account activation link problem
Post by: franzpeter on April 24, 2014, 10:21:26 AM
It depends on the template and if captcha is activated or not. If a template is not adapted to the new VM version and Captcha is activated, customers cannot login. The missing verification code comes from the captcha message. So I think it is a template issue. With the orginal VM (no foreign template) it works as expected. You need a template update if you want to use Captcha or switch it off in the Virtuemart backend, as long as you have no template update for VM 2.6.
Title: Re: account activation link problem
Post by: Milbo on April 24, 2014, 10:26:48 AM
Quote from: escozul on April 22, 2014, 23:10:03 PM


Even if you select activation method: none and the user is activated automaticaly, the new users are unable to log in. The system reports "Username and password do not match or you do not have an account yet"


Update: It seems that downgrading Joomla from 2.5.19 to 2.5.17 makes the issue go away. I guess that can help with debugging the issue.

I deactivated the user registration and it works normal. Due the added possiblity to use a captcha, we think it is indeed the best to adjust the template (or to remove the override of that sublayout) and use the captcha option.
Title: Re: account activation link problem
Post by: marcq on November 22, 2015, 09:38:54 AM
Hi

Same issue with VirtueMart 3.0.12 and virtuemartemplates.net Illusion. Template is adapted to Joomla 3 versions and to Virtuemart 3 versions (http://demo.virtuemarttemplates.net/). Captcha is not activated.

Activation link work fine with Chrome but not with Firefox.

Any solution in the meantime?

Cheers,

Marc
Title: Re: account activation link problem
Post by: Mayapi on February 20, 2016, 14:38:46 PM
Quote from: marcq on November 22, 2015, 09:38:54 AM
Hi

Same issue with VirtueMart 3.0.12 and virtuemartemplates.net Illusion. Template is adapted to Joomla 3 versions and to Virtuemart 3 versions (http://demo.virtuemarttemplates.net/). Captcha is not activated.

Activation link work fine with Chrome but not with Firefox.


I have make lots of add to cart tests, registration tests, and account activation tests after email sent, ... on joomla 3.4.8 and Virtuemart 3.0.12 ...

For me activation link with captcha activated work good on Explorer, Firefox, Chrome but not work on Opera(developer not tested with public version) and i dont know with Safari ( dont have mac ).

Title: Re: account activation link problem
Post by: GJC Web Design on February 21, 2016, 00:44:15 AM
still can't understand why you would want activation on a shop

If a spammer goes to the trouble of filling all the registration etc (to do what?  Buy a product  :o) he will then activate their account

On the other hand 50% of real clients won't understand why the hell they have to and won't do it..  or wont find the email etc etc

It completely breaks the workflow of the cart and will lead to non sales

If they input the email address wrongly by mistake they never get the mail any way so its hardly a check of email accuracy,.. in any case another sale lost