Beispiel #1
0
  public static User create(final AuthUser authUser) {
    final User user = new User();
    user.active = true;
    user.lastLogin = new Date();
    user.creationTimestamp = new Date();
    user.password = authUser.getId();

    if (authUser instanceof EmailIdentity) {
      final EmailIdentity identity = (EmailIdentity) authUser;
      // Remember, even when getting them from FB & Co., emails should be
      // verified within the application as a security breach there might
      // break your security as well!
      user.email = identity.getEmail();
      // TODO: Change to false !!!!!!!!!!
      user.emailValidated = true;
    }

    if (authUser instanceof MyExtendedIdentity) {
      final MyExtendedIdentity identity = (MyExtendedIdentity) authUser;
      user.companyName = identity.getCompanyName();
      user.contactName = identity.getContactName();
      user.contactPhone = identity.getContactPhone();
      user.addressLine1 = identity.getAddressLine1();
      user.addressLine2 = identity.getAddressLine2();
      user.addressLine3 = identity.getAddressLine3();
      user.suburb = identity.getSuburb();
      user.state = identity.getState();
      user.postcode = identity.getPostcode();
    }
    user.save();
    if (user.id != null) {
      user.createDatabases();
    }
    return user;
  }
 public void update(final AuthUser authUser) {
   this.setProviderKey(authUser.getProvider());
   this.setProviderUserId(authUser.getId());
 }