Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (21 sloc) 810 Bytes
global class GoogleAppsRegistrationHandler implements Auth.RegistrationHandler{
global User createUser(Id portalId, Auth.UserData data){
// If the email scope has been set we will receive the users email address
String email =;
if (email == null) return null;
// Make sure the email matches our domain
// TODO: Uncomment and update as necessary
// if (!email.contains('')) return null;
// Attempt to find a user with the same email address
User u;
try {
u = [Select Id, FirstName, LastName, Email, Username from User Where Username = :email];
} catch (Exception e){
return null;
return u;
global void updateUser(Id userId, Id portalId, Auth.UserData data){
// DO Nothing in the update Scenario
You can’t perform that action at this time.