mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-20 12:40:38 +02:00
Remove dashes from pins
This commit is contained in:
parent
2d396cb589
commit
13e94a8b1b
|
@ -47,13 +47,13 @@ namespace Emby.Server.Implementations.Library
|
||||||
using (var str = File.OpenRead(resetfile))
|
using (var str = File.OpenRead(resetfile))
|
||||||
{
|
{
|
||||||
spr = await _jsonSerializer.DeserializeFromStreamAsync<SerializablePasswordReset>(str).ConfigureAwait(false);
|
spr = await _jsonSerializer.DeserializeFromStreamAsync<SerializablePasswordReset>(str).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr.ExpirationDate < DateTime.Now)
|
if (spr.ExpirationDate < DateTime.Now)
|
||||||
{
|
{
|
||||||
File.Delete(resetfile);
|
File.Delete(resetfile);
|
||||||
}
|
}
|
||||||
else if (spr.Pin.Equals(pin, StringComparison.InvariantCultureIgnoreCase))
|
else if (spr.Pin.Replace('-', '').Equals(pin.Replace('-', ''), StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
var resetUser = _userManager.GetUserByName(spr.UserName);
|
var resetUser = _userManager.GetUserByName(spr.UserName);
|
||||||
if (resetUser == null)
|
if (resetUser == null)
|
||||||
|
@ -85,11 +85,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
string pin = string.Empty;
|
string pin = string.Empty;
|
||||||
using (var cryptoRandom = System.Security.Cryptography.RandomNumberGenerator.Create())
|
using (var cryptoRandom = System.Security.Cryptography.RandomNumberGenerator.Create())
|
||||||
{
|
{
|
||||||
byte[] bytes = new byte[4];
|
byte[] bytes = new byte[4];
|
||||||
cryptoRandom.GetBytes(bytes);
|
cryptoRandom.GetBytes(bytes);
|
||||||
pin = BitConverter.ToString(bytes);
|
pin = BitConverter.ToString(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime expireTime = DateTime.Now.AddMinutes(30);
|
DateTime expireTime = DateTime.Now.AddMinutes(30);
|
||||||
string filePath = _passwordResetFileBase + user.InternalId + ".json";
|
string filePath = _passwordResetFileBase + user.InternalId + ".json";
|
||||||
|
|
Loading…
Reference in a new issue