public async Task <bool> Update(CredentialSetting passwordSettings) { var record = await _context.CredentialSettings.FirstOrDefaultAsync().ConfigureAwait(false); if (record == null) { _context.CredentialSettings.Add(new Models.CredentialSetting { AuthenticationIntervalsInSeconds = passwordSettings.AuthenticationIntervalsInSeconds, IsBlockAccountPolicyEnabled = passwordSettings.IsBlockAccountPolicyEnabled, NumberOfAuthenticationAttempts = passwordSettings.NumberOfAuthenticationAttempts, CredentialType = passwordSettings.CredentialType, ExpiresIn = passwordSettings.ExpiresIn, Options = passwordSettings.Options }); } else { record.AuthenticationIntervalsInSeconds = passwordSettings.AuthenticationIntervalsInSeconds; record.IsBlockAccountPolicyEnabled = passwordSettings.IsBlockAccountPolicyEnabled; record.NumberOfAuthenticationAttempts = passwordSettings.NumberOfAuthenticationAttempts; record.ExpiresIn = passwordSettings.ExpiresIn; record.Options = passwordSettings.Options; } await _context.SaveChangesAsync().ConfigureAwait(false); return(true); }
public GitHubLogin(IHttpContextAccessor contextAccessor) : base( contextAccessor) { Credential = new CredentialSetting() { ClientId = SendCacheStore.GetSystemValue("githubClientID"), ClientSecret = SendCacheStore.GetSystemValue("githubClientSecret") }; _authorizeUrl = "https://github.com/login/oauth/authorize?client_id=" + Credential.ClientId; }
public Task <bool> Update(CredentialSetting credentialSetting) { var record = _credentialSettings.FirstOrDefault(r => r.CredentialType == credentialSetting.CredentialType); if (record == null) { return(Task.FromResult(false)); } record.AuthenticationIntervalsInSeconds = credentialSetting.AuthenticationIntervalsInSeconds; record.IsBlockAccountPolicyEnabled = credentialSetting.IsBlockAccountPolicyEnabled; record.NumberOfAuthenticationAttempts = credentialSetting.NumberOfAuthenticationAttempts; record.ExpiresIn = credentialSetting.ExpiresIn; record.Options = credentialSetting.Options; return(Task.FromResult(true)); }