Esempio n. 1
0
 public static int CreateUser(Config config, string username, string twofactorcode, string emailVerificationPath)
 {
     using (var connection = DbConnectionFactory.CreateAndOpen(config.Server, config.Database))
         return(connection.Execute("insert into users (username, twofactorcode, isverified, VerificationExpiryDate, EmailVerificationPath) values (@username, @twofac, 0, @verifyDate, @verifyPath)",
                                   new {
             username = username,
             twofac = twofactorcode,
             verifyDate = DateTime.Now.AddDays(1),
             verifyPath = emailVerificationPath
         }));
 }
Esempio n. 2
0
        public static void Create()
        {
            var connection = DbConnectionFactory.CreateAndOpen(TestInstance, "master");

            try
            {
                connection.Execute(Resources.SafeDropTestDb);
            }
            catch { }

            connection.Execute("Create database InsectTest");

            connection.Execute(Resources.DropAndCreateDb);
        }
Esempio n. 3
0
        public LoginIntegrationTests()
        {
            DbCreator.Create();
            conn = DbConnectionFactory.CreateAndOpen(DbCreator.TestInstance, TestDb);

            var config = new Config
            {
                Database = TestDb,
                Server   = DbCreator.TestInstance
            };

            userId = DbCreator.CreateUser(config, TestUser, TestTwoFactorCode, TestVerificationPath);

            var authStore = new AuthStore(config);

            _authService = new AuthenticationService(authStore);
        }
Esempio n. 4
0
 public AuthStore(Config config)
 {
     conn = DbConnectionFactory.CreateAndOpen(config.Server, config.Database);
 }