This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PasswordGenerator | |
{ | |
// https://stackoverflow.com/questions/65393858/force-the-password-to-contain-lower-case-upper-case-special-character-and-numb | |
private const string Uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
private const string Lowercase = "abcdefghijklmnopqrstuvwxyz"; | |
private const string Symbol = "!-_*+&$#@')(%"; | |
private const string Number = "0123456789"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* amplify-js / cognito auth helper | |
* specific personas are logged-in and their tokens are cached to save on round-trips. | |
*/ | |
import { Amplify } from 'aws-amplify'; | |
import { signIn, SignInOutput, signOut } from '@aws-amplify/auth'; | |
import { ResourcesConfig } from '@aws-amplify/core'; | |
console.log('configuring amplify'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
import { Observable, of, throwError } from 'rxjs'; | |
import { delay, catchError, switchMap } from 'rxjs/operators'; | |
import { LoggingService } from '@logging/logging.service'; | |
@Injectable() | |
export class ObjectContextExceptionRetryInterceptor implements HttpInterceptor { | |
private retryCount = 3; | |
private retryWaitTime = 1500; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<NpgsqlTsVector> ToTsVector(DbContext dbContext, string content) | |
{ | |
var connection = dbContext.Database.GetDbConnection() as NpgsqlConnection; | |
await using var cmd = new NpgsqlCommand("select to_tsvector('english', @content)", connection ); | |
cmd.CommandType = CommandType.Text; | |
if (connection!.State != ConnectionState.Open) connection.Open(); | |
cmd.Parameters.Add(new NpgsqlParameter("content", content)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<NpgsqlTsQuery> ToTsQuery(DbContext dbContext, string searchTerm) | |
{ | |
var connection = dbContext.Database.GetDbConnection() as NpgsqlConnection; | |
await using var cmd = new NpgsqlCommand("select plainto_tsquery('english', @search_term)", connection); | |
cmd.CommandType = CommandType.Text; | |
if (connection!.State != ConnectionState.Open) connection.Open(); | |
cmd.Parameters.Add(new NpgsqlParameter("search_term", searchTerm)); |