You may want to do some history searching on the mail list archives for 
related issues with changing the username while logged in.

TurbineSecurity I believe tries to do an update on the user once the user 
logs out and if the user name has changed, it will think that it needs to 
create a new user account (since it will default to finding an unmatched 
username on your user object)

most of the security service is related to the username as the primary 
key, so you will need to be careful for putting together a solution that 
does not create multiple users and instead just updates the username as 
you wish. 

be sure to check if the username they wish to change to isn't being used 
already, or it could cause even more problems.

related thread from the past:

 http://marc.theaimsgroup.com/?l=turbine-user&m=104405212018687&w=2

just looking at your code, it looks like you are attempting to remove the 
user before updating the user.. I don't think this is what you want to do

Jeff Painter


On Tue, 11 May 2004, Ilan Azbel wrote:

> Hello,
> 
> Is it possible for users to change their own username while being logged in?
> If so, how?
> 
> I do the following with little success (truncated version):
> 
> TurbineSecurity.removeUser(u);
> org.apache.turbine.om.security.TurbineUser NewUser = new
> org.apache.turbine.om.security.TurbineUser();
> NewUser.setEmail("[EMAIL PROTECTED]");
> NewUser.setFirstName("ilan");
> NewUser.setLastName("azbel");
> NewUser.setUserName("newusername");
> TurbineSecurity.addUser(NewUser, pp.getString("Password"));
> TurbineSecurity.grant(NewUser, TurbineSecurity.getGlobalGroup(),
>                                 TurbineSecurity.getRole("turbine_root"));
> data.setUser(TurbineSecurity.getAuthenticatedUser(NewUser.getUserName(),
> "pwd");
> 
> Ilan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to