Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Activate Account by clicking url in email

 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have one registration page.In the button click event(submit) when user click on submit button a confirmation mail should be sent to the User. User should confirm mailid by clicking on link sent in mail. .
On click of link in email or on copy/paste activate account ( Redirect to activation page)
This link shall expire after clicking once. please suggest me .


I have send the mail. its work fine. but can some one suggest method to activate Account by clicking the link. I am using spring,jsf, jpa,jboss.

Thanks in advance...
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
During the registration you create a random activation key that you save somewhere (e.g. database). Your activation controller (the one that is called when the user clicks the link) search in the database for this activation key and if it's found mark the user with a flag as 'activated'. If it's not found (or the activation-flag is already set), show an error message.
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joachim Rohde,

when the user register with my application I am storing 0 as activation code in database and same time sending mail to that user.

what i have to know is that,

how to change that activation code 0 to 1 by clicking url in email.

Thanks in advace...
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You include the activation key (which needs to be unique as well as random) as a parameter in the URL in your mail.
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.. In email , i am sending this link "http://localhost:8080/prototype5JTA/faces/activate.jsp?activate=1&acid=70" . so when user click this link in email. i want get that activate id and cid. if i can get those in to jsf manage bean i can update database. any suggestions ?

Thanks in Advance
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getParameter("activate") and request.getParameter("acid") in your JSP file?
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.. But when user click email link in email from server side i have to update database. so for that i have to get parameter to java class or implement method when user click url in mail.
? so I don't want get url parameters in jsp page. i want get update database when user click url in email. any suggestion



Thanks in Advance
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no way to connect to a DB from a link embedded in an email; it will have to go through server processing of some kind via HTTP. If you don't want JSP, fine - use a servlet (better anyway), or PHP, or ASP.Net, or whatever other server-side technology you prefer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic