1
0
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:
Kyle Spearrin 2019-05-01 10:33:48 -04:00
parent a018369ae8
commit caaec3ea57
2 changed files with 3 additions and 2 deletions

View File

@ -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
{ {

View File

@ -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));