mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-22 12:45:53 +12:00
Add VSIX Installer project
This commit is contained in:
parent
567b848eea
commit
6891561263
37 changed files with 2517 additions and 859 deletions
|
@ -48,10 +48,10 @@ namespace HISP.Server
|
|||
|
||||
public static void OpenDatabase()
|
||||
{
|
||||
if (!ConfigReader.SqlLite)
|
||||
ConnectionString = "server=" + ConfigReader.DatabaseIP + ";user=" + ConfigReader.DatabaseUsername + ";password=" + ConfigReader.DatabasePassword + ";database=" + ConfigReader.DatabaseName;
|
||||
else
|
||||
ConnectionString = "Data Source=./" + ConfigReader.DatabaseName + ".db;";
|
||||
if (!ConfigReader.SqlLite)
|
||||
ConnectionString = "server=" + ConfigReader.DatabaseIP + ";user=" + ConfigReader.DatabaseUsername + ";password=" + ConfigReader.DatabasePassword + ";database=" + ConfigReader.DatabaseName;
|
||||
else
|
||||
ConnectionString = "Data Source=\"" + ConfigReader.DatabaseName + ".db\";";
|
||||
|
||||
Logger.InfoPrint(ConnectionString);
|
||||
|
||||
|
@ -6146,6 +6146,26 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
}
|
||||
public static void SetPasswordHash(string username, string passhash)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
db.Open();
|
||||
if (CheckUserExist(username))
|
||||
{
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Users SET PassHash=@hash WHERE Username=@name";
|
||||
addWithValue(sqlCommand, "@hash", passhash);
|
||||
addWithValue(sqlCommand, "@name", username);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new KeyNotFoundException("Username " + username + " not found in database.");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static byte[] GetPasswordHash(string username)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue