Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions String Validation changing password

Have Programming Question? Ask it here!
 
 
 


Sujitha
String Validation changing password
1 Answer(s)      2 years ago
Posted in : JavaScript Questions


Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.


Advertisement
View Answers

August 16, 2012 at 3:42 PM


Here is a code that accepts the current password, New password and conform password from the user and change the password.

1)change.jsp

<html>
<script>
function validate(){
if(document.f.new.value!=document.f.confirm.value){
alert("New Password and Confirm Password should be same! Re-enter confirm-password!");
document.f.confirm.value="";
return false;
}
return true;
}
</script>
<form name="f" action="changePassword.jsp" method="post" onsubmit="return validate();">
<table>
<tr><td>Current Password</td><td><input type="password" name="current" ></td></tr>
<tr><td>New Password</td><td><input type="password" name="new"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="confirm"></td></tr>
<tr><td><input type="submit" value="Change Password"></td></tr>
</table>
</form>
</html>

2)changePassword.jsp

<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
String currentPassword=request.getParameter("current");
String Newpass=request.getParameter("new");
String conpass=request.getParameter("confirm");
String connectionURL = "jdbc:mysql://localhost:3306/test";
Connection con=null;
String pass="";
int id=0;
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(connectionURL, "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login where password='"+currentPassword+"'");
if(rs.next()){
id=rs.getInt(1);
pass=rs.getString(3);
}
System.out.println(id+ " "+pass);
if(pass.equals(currentPassword)){
Statement st1=con.createStatement();
int i=st1.executeUpdate("update login set password='"+Newpass+"' where id='"+id+"'");
out.println("Password changed successfully");
st1.close();
con.close();
}
else{
out.println("Invalid Current Password");
}
}
catch(Exception e){
out.println(e);
}
%>


Related Tutorials/Questions & Answers:
Changing root Password
Changing root Password  how do i change the root password in mysql
Password validation
password and confirm password are same or not Validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here
Advertisements
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
String Validation
String Validation changing password  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give
password validation with special character
password validation with special character  how to validate password with special character using java script
String Validation
String password Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message
String Validation
String Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
String Validation
String Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
Login Password Validation iPhone / iPAD
Login Password Validation iPhone / iPAD  HOW TO WRITE A TEST CASE TO SET THE VALIDATION FOR LOGIN AND PASSWORD FIELD IN OBJECTIVE C, IOS.   @implementation LoginViewTests - (void)testPasswordFieldIsNotEmpty
string validation in php - PHP
string validation in php  Can you please post a example of PHP Built-in String Validation Functions
how to reverse a string without changing its place
how to reverse a string without changing its place  how to reverse a string without changing its place   Hi Friend, Another way of reversing string: import java.util.*; public class ReverseString{ public static
JavaScript password validation
JavaScript password validation We are going to discuses about JavaScript password special characters validation. In this example we have created one "... used JavaScript password validation and check for an alphabet , number
MySQL Creating account and changing password
MySQL Creating account and changing password   ...; password to same random to be string . the better way is to change the login... or  you want to change the password then make new user .This lesson you learn how
jQuery password validation
jQuery password Validation : jQuery "equalTo: "#password" " is the method to validate or check password if the element is empty (text input... validation we can check that password and verify password are equal.   
Password
Password  make a program which ask ask the username and password * in this format. in C language
validation
validation  validation
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
changing of data...
servlet.database is not changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have... this servlet.database is not changing in 10 second...what should i do..?? reply fast
changing of data...
data changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but... is not changing in 10 second...what should i do..?? reply fast
changing of data...
changing of data...  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but once... is not changing in 10 second...what should i do..?? reply fast
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation
validation  How to validate username and password in a login screen
Validation
; static DefaultTableModel model; public static void main(String[] args) { String...(); String columnName = table.getModel().getColumnName(0); headerRenderer.setText...); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel
validation
; private String name; private String password; private String gender...;</td> </tr> <tr> <td>Password :</td> <td><form:password path="password" /><
validation
Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use Validation method valid the in put
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
Validation
; <b>Password</b> :<input type="Password
Validation
; <b>Password</b> :<input type="Password
Validation
actionPerformed(ActionEvent ae){ String value1=text1.getText(); String value2...(Exception e){} } }); } } class FormDemo{ public static void main(String arg
Username password
with the validation, so that if the username and password match it will continue... that checks whether the username and password is valid or not. If the user...("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("SUBMIT
changing uiview background color
changing uiview background color  changing UIView background color in ios   self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:230.0f/255.0f blue:183.0f/255.0f alpha:1.0f
changing the file content
changing the file content  I have requirement like this, a file contain maximum 1000 lines. I want to cahnage the 501 line content. I know this logic... more file and storing this changeing information String line=null; String
Changing pictures - Java Beginners
Changing pictures  I found some html code that allows pictures to be changed on a web page. I copied the code and saved it as an html file. when I... Explorer that have pictures changing on them and they do not get blocked? 
Changing MySQL Port Number
Changing MySQL Port Number  How to change the MySQL port no in windows.   Hi, Open the my.ini file present in the MySQL server installation directory. Change the port number to desired port number. By default port
password - Security
password  How can i do password encript and decript in java  Hi friend, Code to encript and decript password in java import... { public static void main(String[] args) throws Exception{ String
Changing 2D graph using slider.
Changing 2D graph using slider.  Code for changing a 2d graph with help of slider
forgot password?
forgot password?  forgot password
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color rectangle around image. how do i change color of that rectangle from brown to white
password check
password check  how to check sighup passowrd and login password
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
NSURL Validation
NSURL Validation  How to validate a NSURL string using special character validation
Reset Password
Reset Password  coding for reset password
retype password
retype password  coding for retype password
color changing - Java Beginners
*; public class CreateTabbedPane{ public static void main(String[] args
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password
forget password  codding for forget password using spring framework
 

 

 

DMCA.com