AnsweredAssumed Answered

user created using javascript API not able to login

Question asked by spatils on Sep 9, 2009
Latest reply on Mar 9, 2010 by sselvan
I have written a custom javascript API to create user.
I am able create user using following code. I can verify other properties of user from admin console.
But newly created user is not able to login.
When I try to change password of the user from admin console I get following error
"A system error happened during the operation: User name does not exist: tt1"

Am I missing somthing over here?
Is it possible to create a working user using java script API Or I must use java code for this operation?

model.username = args.username;
model.firstname=args.firstname;
model.lastname=args.lastname;
model.password=args.password;
model.email=args.email;

var person = people.createPerson(args.username);
person.properties["firstName"]=args.firstname;
person.properties["lastName"]=args.lastname;
person.properties["email"]=args.email;
person.properties["userPassword"]=args.password;
person.properties["password"]=args.password;
person.properties["sizeQuota"]="1073741824";                                                 
person.properties["disableAccount"]=false;
person.properties["usr:password"] = args.password;
person.properties["usr:credentialsExpire"]=false;
person.properties["usr:userName"]=args.username;
person.properties["usr:name"]=args.username;

person.save();
person.setPermission("Write", args.username);
person.setPermission("Delete", args.username);
person.setPermission("Read", args.username);
person.setOwner(args.username) ;
person.save();

Outcomes