Ejemplo n.º 1
0
 public static bool UpdateUser(string username, string password)
 {
     using (var bl = Storage.GetBuilder(SQLSafeName))
     {
         var hs = AuthenticatedUsers.Hash(username, password);
         bl.Update(UserTable.TableName, new DataParameter[]
         {
             new DataParameter(UserTable.ColumnNames.Password, hs)
         },
                   new WhereFilter(UserTable.ColumnNames.Username, username)
                   );
         return(Storage.ExecuteNonQuery(bl) > 0);
     }
 }
Ejemplo n.º 2
0
 public static bool CreateUser(string username, string password, bool op = false)
 {
     using (var bl = Storage.GetBuilder(SQLSafeName))
     {
         var hs = AuthenticatedUsers.Hash(username, password);
         bl.InsertInto(UserTable.TableName, new DataParameter[]
         {
             new DataParameter(UserTable.ColumnNames.Username, username),
             new DataParameter(UserTable.ColumnNames.Password, hs),
             new DataParameter(UserTable.ColumnNames.Operator, op),
             new DataParameter(UserTable.ColumnNames.DateAdded, DateTime.Now)
         });
         return(Storage.ExecuteNonQuery(bl) > 0);
     }
 }
Ejemplo n.º 3
0
        public bool ComparePassword(string username, string password)
        {
            var hs = AuthenticatedUsers.Hash(username, password);

            return(hs.Equals(Password));
        }