public BaseUser(BaseRegisterViewModel model) : base(model.UserName) { if (model != null) { if (model is IdentifyingRegisterViewModel) { Email = (model as IdentifyingRegisterViewModel).Email; } if (model.Password != model.ConfirmPassword) { throw new ArgumentException("Supplied Passwords are not the same"); } } else { throw new ArgumentNullException(nameof(model)); } }
//todo: fix public async Task<bool> Register(BaseRegisterViewModel registrationInfo) { if (registrationInfo != null) { using (HttpResponseMessage response = await this._client.PostAsync(this.RegisterRoute, new JsonContent(JsonConvert.SerializeObject(registrationInfo)))) { if (response.IsSuccessStatusCode) { //Grab the cookies var cookies = response.Headers.GetValues("Set-Cookie"); //First(x => x.StartsWith(".AspNetCore.Microsoft.Identity.Application")); var processedCookie = ProcessCookies(CleanCookies(cookies)); this.AuthToken = processedCookie; return true; } else { return false; } } } else { throw new ArgumentNullException(nameof(registrationInfo)); } }