Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global class RegHandler_SF_Identity1 implements Auth.RegistrationHandler{
- // Create simple non-community user
- global User createUser(Id portalId, Auth.UserData data){
- String u_domain='@demo.com';
- String u_local='en_US';
- String u_encKey='UTF-8';
- String u_TZ='Europe/Paris';
- User u = new User();
- Profile p = [SELECT Id FROM profile WHERE name='Standard User'];
- u.username = data.firstname.deleteWhitespace() + u_domain;
- u.email = data.email;
- u.lastName = data.lastName;
- u.firstName = data.firstName;
- String alias = data.username;
- if(alias.length() > 8) alias = alias.substring(0, 8);
- u.alias = alias;
- u.languagelocalekey = u_local;
- u.localesidkey = u_local;
- u.emailEncodingKey = u_encKey;
- u.timeZoneSidKey = u_TZ;
- u.profileId = p.Id;
- return u;
- }
- global void updateUser(Id userId, Id portalId, Auth.UserData data){
- User u = new User(id=userId);
- u.email = data.email;
- u.lastName = data.lastName;
- u.firstName = data.firstName;
- update(u);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement