RE: validation
RE: validation
- Subject: RE: validation
- From: "Jonathan Fleming" <email@hidden>
- Date: Tue, 20 Jan 2004 05:48:04 +0000
This will help you:
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class PasswordPreference extends WOComponent {
protected String oldPassword;
protected String password1;
protected String password2;
protected String _msg;
public PasswordPreference(WOContext context) {
super(context);
// revert changes
session().defaultEditingContext().revert();
}
/*
* actions
*/
public void change() {
String _oldPassword = (String)
valueForKeyPath("session.user.password");
// check the passwords match
if (_oldPassword.equals(oldPassword)) {
if (password1.equals(password2)) {
takeValueForKeyPath(password1, "session.user.password");
session().defaultEditingContext().saveChanges();
_msg = "Your password has been changed";
} else _msg = "New passwords do not match";
} else _msg = "The Current password is incorrect";
}
}
Everything you need to do in your class is in this method strip out as
necassary or use as is.
HTH
Kind regards
Jonathan :^)
From: Ken Foust <email@hidden>
To: email@hidden
Subject: validation
Date: Mon, 19 Jan 2004 22:03:29 -0700
I have two password fields ie WOPasswordField one is the real one and
the other confirms
I am trying to validate one against the other and then save the users
password to the database.
The program builds and works fine it saves the password when I try to
validate this it won't build and complains it can't resolve the variable
"password" I have read all four leading books and have come to the
conclusion that they don't want anyone to know how to do this!!
Any help would be appreciated
Thanks Ken
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.