G-InfoArena will bring to you all IT related information...
from a common computer Information to a complex information all you will find it here.
G-InfoArena is setup mainly with the aim to help the people who are Novice to IT industry.
Monday, 6 May 2013
Code for forgot password module using JSP and Servlet
code for forgot password
Following directory Structure you need to create for
this(Tomcat directory i had used)
Thanx for sharing a valueable code... i hv a little prblm wid my Task manager...its nt enable in my lappy...if u hv knowledge abt it...so plz share wid me..
@abhishek: i think it might be because of viruses in your system. Once u chk registry editor, n chk or locate "disabletaskmgr". U hav to ckh fr dword value . Change it to '0' or create a new value, if its nt there. Restart ur system once. I think it will work.
i am working with your forgot password code, but its giving me internal error occured, please try later, reason = null, i am a beginer could you help me to fix it
I think you are not setting database property properly and getting null pointers from FPDao. So once you go to com.fpwd.commonconfig.DB.properties file and provide a valid db url.
Also for better understanding you can write logs for the project.
Also set a valid "forgetpasswordlink" and "redirectUrl" into DB.properties file.
forgetpasswordlink= This is the link that will be send into mail id for resetting the password.
hi guys apologies for the late reply.. you can download the whole code from link mentioned in the my blog (click here to get link) at the end. Make sure of changing Db urls and mail properties.Configure them properly as per your details. The code is written to send and validate your password link based on these inputs. For better understanding I encouraged all to write logs or sout statement to see code flow. Thank you for showing your interest and your valuable feedback.
if your getting null pointer from authenticateRequest.java then you once check verifyRequest method of FPDao. This method will verify the utid and email with database once you clicked on the reset link in mail Just keep some log in this method to check it. See In case of any exception dataMap will return "RESULT", "EXCEPTION" as exception and "REASON", e.getMessage() and controller will display corresponding message based on this. I think your getting from this place only.
Yes Gaurav I have fixed the error.There was a space coming in the link on the respective mail id and hence the value was not getting returned to the jsp.I have removed the space in the link and the rest of the code is working fine. Thank you for the great post Gaurav. In case I need any further help will definitely contact you.
gaurav, a new problem has arrived again, The code was working fine ,but it is not accepting a new gmail id and password. Every time it is giving a error of javax mail.authenticatin error , username and password are not accepted . it was working fine until i chnaged my password for the gmail account and now its throwing the same error.how to fix it ???
gaurav, a new problem has arrived again, The code was working fine ,but it is not accepting a new gmail id and password. Every time it is giving a error of javax mail.authenticatin error , username and password are not accepted . it was working fine until i chnaged my password for the gmail account and now its throwing the same error.how to fix it ???
hi Gaurav i need to know the overall db structure and scenerio how the coding works , I am a fresher in IT Industry...Can u Revert back to my mail shannushyl@gmail.com
Hi Gaurav, I am getting following exception the transport.connect() method throws exception com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
================================================================================== props.put("mail.smtp.host", host); props.put("mail.smtp.port", port); props.put("mail.smtp.username", mail_from); props.put("mail.smtp.password", mail_pwd); props.put("mail.smtp.auth", authtype); props.put("mail.smtp.debug", "true"); props.put("mail.transport.protocol", "smtp"); /* props.put("mail.smtp.starttls.enable","false"); // if it is true then it enabling SSL on this connection props.put("mail.smtp.socketFactory.port", port); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); //false */
Session session = Session.getInstance(prop, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(mail_from,mail_pwd); } }); ==============================================================================
// send the message int intport=Integer.parseInt(port); Transport transport = session.getTransport("smtp"); transport.connect(host, intport, mail_from, mail_pwd); Transport.send(msg); // This line throws Exception System.out.println("Mail Send sucessfully"); ==================================================================================
Hello sir, when i am working with your forgot password code, but its giving me internal Exception occured, please try later, reason = null, i am a beginer could you help me to fix it.
hello sir,im trying to run your sample project but "encounted error Internal Exception Occured! Please try Later Reason:-null", i already set up to all configuration but have error.
hello sir,im trying to run your sample project but "encounted error Internal Exception Occured! Please try Later Reason:-null", i already set up to all configuration but have error.
goood work bro...!! Keep it going..>!!
ReplyDeleteDear Gaurav,
ReplyDeleteThanx for sharing a valueable code...
i hv a little prblm wid my Task manager...its nt enable in my lappy...if u hv knowledge abt it...so plz share wid me..
Abhishek
@abhishek: i think it might be because of viruses in your system.
ReplyDeleteOnce u chk registry editor, n chk or locate "disabletaskmgr".
U hav to ckh fr dword value . Change it to '0' or create a new value, if its nt there.
Restart ur system once.
I think it will work.
Gaurav
Thanx a lot....i hope it work...
Delete@Gaurav
I am enable to download Code... I have given Request Access (permission) for downloading.. Help me to download it.
ReplyDeletehi Mangesh Mandavgane
DeleteU can download the code directly from the blog now.
i am working with your forgot password code, but its giving me internal error occured, please try later, reason = null, i am a beginer could you help me to fix it
ReplyDeleteHi neelakandan apologies for the late reply..
DeleteI think you are not setting database property properly and getting null pointers from FPDao.
So once you go to com.fpwd.commonconfig.DB.properties file and provide a valid db url.
Also for better understanding you can write logs for the project.
Also set a valid "forgetpasswordlink" and "redirectUrl" into DB.properties file.
forgetpasswordlink= This is the link that will be send into mail id for resetting the password.
Use the below link to download the code
https://drive.google.com/open?id=0B-8DMZISwXbPeW5SZkZjdGxkb1E
I am getting an error :-
ReplyDeleteReason:-Can't find bundle for base name /DB.properties, locale en_GB.
Please help to resolve.
hi anurag,
DeleteMake sure that your DB.properties file must be present in the below dir.
com.fpwd.commonconfig.DB.properties file.
You can download the code from the blog for better understanding.
I am getting an error :- Reason:Null
ReplyDeletehi guys apologies for the late reply..
ReplyDeleteyou can download the whole code from link mentioned in the my blog (click here to get link) at the end.
Make sure of changing Db urls and mail properties.Configure them properly as per your details.
The code is written to send and validate your password link based on these inputs.
For better understanding I encouraged all to write logs or sout statement to see code flow.
Thank you for showing your interest and your valuable feedback.
thanks for the post gaurav,but the authenticate java class is giving a null pointer ,how to fix it ,got stuck with this code
ReplyDeleteif your getting null pointer from authenticateRequest.java then you once check verifyRequest method of FPDao.
DeleteThis method will verify the utid and email with database once you clicked on the reset link in mail
Just keep some log in this method to check it.
See In case of any exception dataMap will return "RESULT", "EXCEPTION" as exception and "REASON", e.getMessage() and controller will display corresponding message based on this.
I think your getting from this place only.
Yes Gaurav I have fixed the error.There was a space coming in the link on the respective mail id and hence the value was not getting returned to the jsp.I have removed the space in the link and the rest of the code is working fine.
ReplyDeleteThank you for the great post Gaurav. In case I need any further help will definitely contact you.
Regards,
Saptarshi
gaurav, a new problem has arrived again, The code was working fine ,but it is not accepting a new gmail id and password.
ReplyDeleteEvery time it is giving a error of javax mail.authenticatin error , username and password are not accepted .
it was working fine until i chnaged my password for the gmail account and now its throwing the same error.how to fix it ???
neeed help from you
gaurav, a new problem has arrived again, The code was working fine ,but it is not accepting a new gmail id and password.
ReplyDeleteEvery time it is giving a error of javax mail.authenticatin error , username and password are not accepted .
it was working fine until i chnaged my password for the gmail account and now its throwing the same error.how to fix it ???
neeed help from you
hi Gaurav i need to know the overall db structure and scenerio how the coding works , I am a fresher in IT Industry...Can u Revert back to my mail shannushyl@gmail.com
ReplyDeleteHi Gaurav,
ReplyDeleteI am getting following exception
the transport.connect() method throws exception
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
==================================================================================
ReplyDeleteprops.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
props.put("mail.smtp.username", mail_from);
props.put("mail.smtp.password", mail_pwd);
props.put("mail.smtp.auth", authtype);
props.put("mail.smtp.debug", "true");
props.put("mail.transport.protocol", "smtp");
/* props.put("mail.smtp.starttls.enable","false"); // if it is true then it enabling SSL on this connection
props.put("mail.smtp.socketFactory.port", port);
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false"); //false
*/
Session session = Session.getInstance(prop, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(mail_from,mail_pwd);
}
});
==============================================================================
// send the message
int intport=Integer.parseInt(port);
Transport transport = session.getTransport("smtp");
transport.connect(host, intport, mail_from, mail_pwd);
Transport.send(msg); // This line throws Exception
System.out.println("Mail Send sucessfully");
==================================================================================
This comment has been removed by the author.
ReplyDeleteHello sir, when i am working with your forgot password code, but its giving me internal Exception occured, please try later, reason = null, i am a beginer could you help me to fix it.
ReplyDeletehello sir,im trying to run your sample project but "encounted error Internal Exception Occured! Please try Later
ReplyDeleteReason:-null", i already set up to all configuration but have error.
This comment has been removed by the author.
ReplyDeletehello sir,im trying to run your sample project but "encounted error Internal Exception Occured! Please try Later
ReplyDeleteReason:-null", i already set up to all configuration but have error.
grt
ReplyDelete