PasswordTextField not showing the value
I have would like to edit an existing user's properties including the password. However, all the other properties are appearing on their corresponding fields except the password field. How do i make it appear?. here is my component for editing users public class UserPanel extends Panel { /** * */ private static final long serialVersionUID = 3819937222116190372L; @Inject private UserDao userDao; private TextFieldString txtUsername; private PasswordTextField txtPassword; private PasswordTextField txtConfPassword; private User user; public UserPanel(String id, final User user) { super(id); this.user = user; FormUser frmCreateUser = new FormUser(frmCreateUser) { /** * */ private static final long serialVersionUID = 1L; @Override protected void onSubmit() { if (user.getId() == null) { Long id = userDao.saveUser(this.getModelObject()); info(User # + id + has been created); } else { Long id = userDao.updateUser(this.getModelObject()); info(User # + id + has been updated); } } }; frmCreateUser.setModel(new ModelUser(user)); add(frmCreateUser); txtUsername = new TextFieldString(txtUsername, new PropertyModelString(user, username)); txtPassword = new PasswordTextField(txtPassword, new PropertyModelString(user, password)); txtConfPassword = new PasswordTextField(txtConfPassword, new PropertyModelString(user, password)); frmCreateUser.add(txtUsername); frmCreateUser.add(txtPassword); frmCreateUser.add(txtConfPassword); } the txtPassword and txtConfPassword fields display empty and so i have to provide a password every time i edit the user. Kindly help Regards Josh
Re: PasswordTextField not showing the value
You can't edit user password because you only store its hash. Don't you? 2010/1/27 Josh Kamau joshnet2...@gmail.com: I have would like to edit an existing user's properties including the password. However, all the other properties are appearing on their corresponding fields except the password field. How do i make it appear?. here is my component for editing users public class UserPanel extends Panel { /** * */ private static final long serialVersionUID = 3819937222116190372L; �...@inject private UserDao userDao; private TextFieldString txtUsername; private PasswordTextField txtPassword; private PasswordTextField txtConfPassword; private User user; public UserPanel(String id, final User user) { super(id); this.user = user; FormUser frmCreateUser = new FormUser(frmCreateUser) { /** * */ private static final long serialVersionUID = 1L; �...@override protected void onSubmit() { if (user.getId() == null) { Long id = userDao.saveUser(this.getModelObject()); info(User # + id + has been created); } else { Long id = userDao.updateUser(this.getModelObject()); info(User # + id + has been updated); } } }; frmCreateUser.setModel(new ModelUser(user)); add(frmCreateUser); txtUsername = new TextFieldString(txtUsername, new PropertyModelString(user, username)); txtPassword = new PasswordTextField(txtPassword, new PropertyModelString(user, password)); txtConfPassword = new PasswordTextField(txtConfPassword, new PropertyModelString(user, password)); frmCreateUser.add(txtUsername); frmCreateUser.add(txtPassword); frmCreateUser.add(txtConfPassword); } the txtPassword and txtConfPassword fields display empty and so i have to provide a password every time i edit the user. Kindly help Regards Josh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PasswordTextField not showing the value
Not sure if that is actually the problem, but have you noticed PasswordTextField#getResetPassword() ? Its default value is 'true', meaning the value is cleared on every rendering. cheers, Jonas On Wed, Jan 27, 2010 at 3:19 PM, Josh Kamau joshnet2...@gmail.com wrote: I have would like to edit an existing user's properties including the password. However, all the other properties are appearing on their corresponding fields except the password field. How do i make it appear?. here is my component for editing users public class UserPanel extends Panel { /** * */ private static final long serialVersionUID = 3819937222116190372L; �...@inject private UserDao userDao; private TextFieldString txtUsername; private PasswordTextField txtPassword; private PasswordTextField txtConfPassword; private User user; public UserPanel(String id, final User user) { super(id); this.user = user; FormUser frmCreateUser = new FormUser(frmCreateUser) { /** * */ private static final long serialVersionUID = 1L; �...@override protected void onSubmit() { if (user.getId() == null) { Long id = userDao.saveUser(this.getModelObject()); info(User # + id + has been created); } else { Long id = userDao.updateUser(this.getModelObject()); info(User # + id + has been updated); } } }; frmCreateUser.setModel(new ModelUser(user)); add(frmCreateUser); txtUsername = new TextFieldString(txtUsername, new PropertyModelString(user, username)); txtPassword = new PasswordTextField(txtPassword, new PropertyModelString(user, password)); txtConfPassword = new PasswordTextField(txtConfPassword, new PropertyModelString(user, password)); frmCreateUser.add(txtUsername); frmCreateUser.add(txtPassword); frmCreateUser.add(txtConfPassword); } the txtPassword and txtConfPassword fields display empty and so i have to provide a password every time i edit the user. Kindly help Regards Josh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PasswordTextField not showing the value
Thanks alot. The getResetPassword() did it. I am doing a trivial application so i have not encrypted the password. May be in a real application i will present a window for resetting password and a separate window for editing the rest of the user details. Regards. On Wed, Jan 27, 2010 at 5:34 PM, Jonas barney...@gmail.com wrote: Not sure if that is actually the problem, but have you noticed PasswordTextField#getResetPassword() ? Its default value is 'true', meaning the value is cleared on every rendering. cheers, Jonas On Wed, Jan 27, 2010 at 3:19 PM, Josh Kamau joshnet2...@gmail.com wrote: I have would like to edit an existing user's properties including the password. However, all the other properties are appearing on their corresponding fields except the password field. How do i make it appear?. here is my component for editing users public class UserPanel extends Panel { /** * */ private static final long serialVersionUID = 3819937222116190372L; @Inject private UserDao userDao; private TextFieldString txtUsername; private PasswordTextField txtPassword; private PasswordTextField txtConfPassword; private User user; public UserPanel(String id, final User user) { super(id); this.user = user; FormUser frmCreateUser = new FormUser(frmCreateUser) { /** * */ private static final long serialVersionUID = 1L; @Override protected void onSubmit() { if (user.getId() == null) { Long id = userDao.saveUser(this.getModelObject()); info(User # + id + has been created); } else { Long id = userDao.updateUser(this.getModelObject()); info(User # + id + has been updated); } } }; frmCreateUser.setModel(new ModelUser(user)); add(frmCreateUser); txtUsername = new TextFieldString(txtUsername, new PropertyModelString(user, username)); txtPassword = new PasswordTextField(txtPassword, new PropertyModelString(user, password)); txtConfPassword = new PasswordTextField(txtConfPassword, new PropertyModelString(user, password)); frmCreateUser.add(txtUsername); frmCreateUser.add(txtPassword); frmCreateUser.add(txtConfPassword); } the txtPassword and txtConfPassword fields display empty and so i have to provide a password every time i edit the user. Kindly help Regards Josh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org