mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-27 12:26:31 +01:00
fix password leaked check
This commit is contained in:
parent
a018369ae8
commit
caaec3ea57
@ -298,7 +298,8 @@ namespace Bit.App.Pages
|
|||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
if(matches > 0)
|
if(matches > 0)
|
||||||
{
|
{
|
||||||
await _platformUtilsService.ShowDialogAsync(string.Format(AppResources.PasswordExposed, matches));
|
await _platformUtilsService.ShowDialogAsync(string.Format(AppResources.PasswordExposed,
|
||||||
|
matches.ToString("N0")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ namespace Bit.Core.Services
|
|||||||
public async Task<int> PasswordLeakedAsync(string password)
|
public async Task<int> PasswordLeakedAsync(string password)
|
||||||
{
|
{
|
||||||
var hashBytes = await _cryptoFunctionService.HashAsync(password, Enums.CryptoHashAlgorithm.Sha1);
|
var hashBytes = await _cryptoFunctionService.HashAsync(password, Enums.CryptoHashAlgorithm.Sha1);
|
||||||
var hash = BitConverter.ToString(hashBytes).ToUpperInvariant();
|
var hash = BitConverter.ToString(hashBytes).Replace("-", string.Empty).ToUpperInvariant();
|
||||||
var hashStart = hash.Substring(0, 5);
|
var hashStart = hash.Substring(0, 5);
|
||||||
var hashEnding = hash.Substring(5);
|
var hashEnding = hash.Substring(5);
|
||||||
var response = await _httpClient.GetAsync(string.Concat(PwnedPasswordsApi, hashStart));
|
var response = await _httpClient.GetAsync(string.Concat(PwnedPasswordsApi, hashStart));
|
||||||
|
Loading…
Reference in New Issue
Block a user