Hello,
I've tried so hard into getting this to work, check this out.
I have a system already filled with username/passwords from a portal, and I want people to be able to register on the forums with a new username/password (The username is a number, like a social security number) but I need to still know who is who, I'm aware there is a authenticator login or something that can help me integrate my current users with the system, the thing is the usernames in the portal are NUMBERS like SSN's and not names or nicknames, therefore, I need to first validate that person is a member of the Portal, if it is, then insert the user into the database + the username from the portal (Which we call cedula)
So, I've made the following changes:
In mysql\db_struct.sql:
Added:
user_cedula varchar(8) NOT NULL default '',
user_passCons varchar(32) NOT NULL default '',
in jforum_users
In User.java entity:
private
String cedula;
private String consultaPassword;
...
...
public void setCedula(String cedula){
this.cedula = cedula;
}
public void setconsultaPassword(String consultaPassword){
this.consultaPassword = consultaPassword;
}
public String getCedula(){
return this.cedula;
}
public String getconsultaPassword(){
return this.consultaPassword;
}
In UserModel.java in drivers\generic (I use MySQL):
..
protected void initNewUser(User user, PreparedStatement p) throws Exception
{
p.setString(1, user.getUsername());
p.setString(2, user.getPassword());
p.setString(3, user.getEmail());
p.setTimestamp(4, new Timestamp(System.currentTimeMillis()));
p.setString(5, user.getActivationKey());
p.setString(6, user.getCedula());
p.setString(7, user.getconsultaPassword());
}
In UserAction.java:
String cedula = this.request.getParameter("cedula");
String passConsulta = this.request.getParameter("passConsulta");
....
/* This one checks the user is registered in the portal */
if (!error){
consultaase myConsulta = new consultaase();
try{
passMy = myConsulta.getPassword(cedula);
}
catch (Exception a) {passMy = "";}
if (((passMy.equals(""))) || (!passMy.equals(passConsulta))){
this.context.put("error", I18n.getMessage("UsernamePasswordCannotBeNull"));
error = true;
}
}
.....
u.setCedula(cedula);
u.setconsultaPassword(passConsulta);
And Finally, on generic_queries:
UserModel.addNew = INSERT INTO jforum_users (username, user_password, user_email, user_regdate, user_actkey, user_cedula, user_passCons) VALUES (?, ?, ?, ?, ?, ?, ?)
Ok, everything 'works' fine, I added two textfields in user_new.htm and named them cedula and passConsulta.
Now, when I try to 'register' I get:
No value specified for parameter 6
This is clearly because somehow is not saving, or assigning, or passing the value cedula and passCons to the SQL statement (That exception is a mysql exception).
I'm running
Tomcat 5, SDK1.4.02 and mysql 4.
Thanks!
[originally posted on jforum.net by Damian]