mirror of
https://github.com/Jackett/Jackett.git
synced 2025-12-26 23:44:50 +01:00
Saved password security
This commit is contained in:
@@ -19,6 +19,7 @@ namespace Jackett.Models.Config
|
||||
public bool AllowExternal { get; set; }
|
||||
public string APIKey { get; set; }
|
||||
public string AdminPassword { get; set; }
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
public string[] GetListenAddresses(bool? external = null)
|
||||
{
|
||||
@@ -38,19 +39,5 @@ namespace Jackett.Models.Config
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateApi()
|
||||
{
|
||||
var chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var randBytes = new byte[32];
|
||||
var rngCsp = new RNGCryptoServiceProvider();
|
||||
rngCsp.GetBytes(randBytes);
|
||||
var key = "";
|
||||
foreach (var b in randBytes)
|
||||
{
|
||||
key += chars[b % chars.Length];
|
||||
}
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user