similar login module is already there . It's CustomMembershipLoginModule. You need to work with GateIn trunk or wait to GateIn 3.2 because this login module is not in latest released GateIn 3.1. Source code is here http://anonsvn.jboss.org/repos/gatein/portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/CustomMembershipLoginModule.java and more info in this jira https://issues.jboss.org/browse/GTNPORTAL-1347 .
For your case, I think that you need to call authenticator.createIdentity after your user is created. And this newly created instance of Identity object needs to be added into sharedState map under key "exo.security.identity" . See code of existing login modules like CustomMembershipLoginModule or SSOLoginModule. I think that you are seeing problems because you are calling authenticator.createIdentity before adding users, and so Identity object does not have "/platform/users" membership for the first time, which means that you are not seeing Sign In , Register and Change Language links .
Hope this helps,