check account activation on login

samoht 11 Dec, 2010
Hello,

I'm using Chronoforms for both my registration and my login forms - and I have my Joomla setup to require account activation. On registration an email is sent to the user for activation and the user is redirected to a page that informs them they need to activate their account by following the link in the email that was sent to them, then they can login. For what ever reason some users are registering and then not activating their accounts - then months later coming back to the site trying to login. They complain that they aren't able to login - and I explain that they needed to activate their account etc.

I would like to perform a check on login that catches if the user attempting a login needs to activate their account and then responds with a message ((The Account You are Trying to Login to has NOT Yet been activated ))

It would also be nice if I could include a link to re-send the activation email.

Any ideas how to??

Thanks,
GreyHead 11 Dec, 2010
Hi samoht,

You can replace the login with a ChronoForm that uses either Ajax or Server-side validation to check if that username has an account registered and, if so, what the status is.

You'd need to add code to complete the login if the account is activated but you can probably borrow this from the Joomla! form.

Bob
samoht 11 Dec, 2010
HI Bob,

So should I put the AJAX on the "password" input ?
GreyHead 12 Dec, 2010
Hi samoht,

Not the password field as more than one user can use the same password. The Username and email values are required to be unique.

Bob
samoht 12 Dec, 2010
Thanks Bob,

I got it working - and as you noticed I needed to pass the username and the password through as variables - but I was able to through that into an onblur on the password field.

The AJAX is simple and I just parse the redirect url with the variables intact to get my query for the database. Hopefully that does not pose a security risk. But it works.

Thanks again,
samoht 15 Dec, 2010
Hey Bob,

So now that I got it working the client would like me to include a link to have the activation email resent. - I didn't find much on this Googling expect some components or plugins that resent the activation email automatically. Do you have any ideas how I could just include a link for the the user to click if they wanted an activation email resent?

Thanks
samoht 15 Dec, 2010
...?

Could I write the link like
<a href="/index.php?username='.$users->username.'&option=com_chronocontact&task=send&chronoformname=RequestActivationLink"


Then have a form RequestActivationLink that $_GETs the username from the url checks the database for that username and grabs the "activation" link, the "email"
and throws those into inputs?

or is that the wrong way to use the send task?
samoht 15 Dec, 2010
this is what I came up with on my ajax page
if ( count($users) > 0 ) {
echo '<div style="color:red; font-style:bold; padding:7em;"><h2>You are not active yet - even though you are registered.</h2><br><p>Please see your activation email and follow the link provided</p>';
echo '<a href="/index2.php?username='.$_GET[u].'&email='.$users->email.'&option=com_chronocontact&task=send&chronoformname=ResendActivation" />Resend Activation Email</a></div>';
}


everything works it seems.
Then I did create a form called "ResendActivation" that sends and email with the activation link inside. The problem is that I am denied access to that url?

Any ideas??
samoht 15 Dec, 2010
Hmm,

So I tried removing the "task=send"
which gave me access to the url and sent me to the form - username and email were still in the url so I hit send - and it sent to the right email address - but the email was empty. I'm sure I could get this to work this way - but I would much rather have it work in the background with out having to open the "ResendActivation" form.
samoht 15 Dec, 2010
OK,

I finally solved it myself. I now have an ajax link using an onclick in a normal anchor to pass the varibles to my ResendActivation form which really just holds the code to send the email with the correct database info.

I'm tiered now!

:)
This topic is locked and no more replies can be posted.