private OAuthUser CreateUser(Profile profile) { var user = new OAuthUser(); var existingUser = PortalRepository.UserInfoGet(null, null, profile.Email, null).FirstOrDefault(); if (existingUser == null) { user.UserGuid = Guid.NewGuid(); if (PortalRepository.UserCreate(user.UserGuid, profile.Email) != 1) throw new LoginException("Failed to create new user"); } else user.UserGuid = existingUser.Guid; AuthenticationModule.AuthenticationRepository.OAuth.OAuthUserUpdate(user.UserGuid, profile.UniqueID); return user; }
private Session AuthenticateSession(OAuthUser user) { return Request.Session != null ? PortalRepository.SessionUpdate(Request.Session.Guid, user.UserGuid) : PortalRepository.SessionCreate(user.UserGuid); }