Account Activation Email Validation Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Thanks, I will have a look.  I'm actually running the no source code version so I will need to get that wired up.
12 years ago
Hi Andrey,

we have the same problem. To illustrate it better I will say all the steps to reproduce it easier and point to the place where I think the problem is.

1. Check the "Usernames enabled" from the admin panel in customer settings.
2. Set the registration method to be "Email validation"

thus when a new customer is registered they receive an email validation that redirects to the site for completing the registration.

The problem is that in the "Customer.EmailValidationMessage" message template, which is used for the email, the token that is used for this url is "Customer.AccountActivationURL", which in the "AddCustomerTokens" method in the MessageTokenProvider is replaced in the following way:

"tokens.Add(new Token("Customer.AccountActivationURL", string.Format("{0}customer/activation/{1}/{2}", _webHelper.GetStoreLocation(false), customer.GetAttribute<string>(SystemCustomerAttributeNames.AccountActivationToken), customer.Username)));"

So the username of the customer is used.

On the other hand the action in the customer controller expects an email as an argument:

public ActionResult AccountActivation(Guid token, string email)
        {
            var customer = _customerService.GetCustomerByEmail(email);
            if (customer == null)
                return RedirectToAction("Index", "Home");
.......
}

and the result is that the customer object is null and the client is redirected to the home page.

In short, the link in the validation email looks like:

http://mydomain.com/customer/activation/{guid}/{username}

while the action expects url like the following

http://mydomain.com/customer/activation/{guid}/{email}




The quick fix we did is to change the action to expects username instead of email:

public ActionResult AccountActivation(Guid token, string email)
        {
            var customer = _customerService.GetCustomerByUsername(email);
            if (customer == null)
                return RedirectToAction("Index", "Home");
.......
}

Hope this helps!
12 years ago
7Spikes wrote:
we have the same problem. To illustrate it better I will say all the steps to reproduce it easier and point to the place where I think the problem is.

That's another issue. It was fixed in v2.10
12 years ago
madv1457 wrote:
Thanks, I will have a look.  I'm actually running the no source code version so I will need to get that wired up.


I second this concern. I was hoping that I could run your change, but I'm also running the no source code version. Is there a change that I could implement?
12 years ago
a.m. wrote:
Can you please make the following changes and let me know whether it helps:
1. Open \src\Presentation\Nop.Web\Controllers\CustomerController.cs
2. Replace
public ActionResult AccountActivation(Guid token, string email)

with
public ActionResult AccountActivation(string token, string email)


Tried, seem to produce no effect.
Observation (original v2.1 code): if I delete parameters from the emailed URL - I always get error like "resource not found or WEB page not found" (in two different variants, for complete URL and URL with missing parameters), if I replace the "activation" with "accountactivation" (a quick improvisation to match the class method name) then I get the same error for the complete URL and an exception due to missing parameter if I delete one or both from the URL.
Information provided above has to be taken critically: due to lacking time (playing with a working store on a remote server is rather time-consuming and is not very handy in general) no serious investigation was made, just quick experiments, which are often subject to experimenter's human factor :)
12 years ago
Can you please test it with the latest changeset e92b8b62f0c8?
12 years ago
Fixed. Please see changeset 7e7205270454
12 years ago
Thanks Andrei,
Since I am not running the source code version is there any way to get the fix that I can include in the web version?  

Thanks for the help!
Mark
12 years ago
a.m. wrote:
Fixed. Please see changeset 7e7205270454


Also, I accidentally hit the down arrow on the vote so it's showing -1 to your post.  Went to try to fix it but says I already voted.  Sorry about that.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.