mirror of
https://github.com/bitwarden/mobile
synced 2026-01-04 17:43:17 +00:00
Password reprompt (#1365)
* Make card number hidden * Add support for password reprompt * Rename PasswordPrompt to Reprompt * Protect autofill * Use Enums.CipherRepromptType * Fix iOS not building * Protect iOS autofill * Update to match jslib * Fix failing build
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Bit.Core.Abstractions
|
||||
void SaveFile();
|
||||
Task<bool> ShowDialogAsync(string text, string title = null, string confirmText = null,
|
||||
string cancelText = null, string type = null);
|
||||
Task<bool> ShowPasswordDialogAsync(string title, string body, Func<string, Task<bool>> validator);
|
||||
void ShowToast(string type, string title, string text, Dictionary<string, object> options = null);
|
||||
void ShowToast(string type, string title, string[] text, Dictionary<string, object> options = null);
|
||||
bool SupportsU2f();
|
||||
|
||||
8
src/Core/Enums/CipherRepromptType.cs
Normal file
8
src/Core/Enums/CipherRepromptType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Enums
|
||||
{
|
||||
public enum CipherRepromptType : byte
|
||||
{
|
||||
None = 0,
|
||||
Password = 1,
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
Cipher_ClientAutofilled = 1114,
|
||||
Cipher_SoftDeleted = 1115,
|
||||
Cipher_Restored = 1116,
|
||||
Cipher_ClientToggledCardNumberVisible = 1117,
|
||||
|
||||
Collection_Created = 1300,
|
||||
Collection_Updated = 1301,
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Bit.Core.Models.Data
|
||||
Name = response.Name;
|
||||
Notes = response.Notes;
|
||||
CollectionIds = collectionIds?.ToList() ?? response.CollectionIds;
|
||||
Reprompt = response.Reprompt;
|
||||
|
||||
try // Added to address Issue (https://github.com/bitwarden/mobile/issues/1006)
|
||||
{
|
||||
@@ -84,5 +85,6 @@ namespace Bit.Core.Models.Data
|
||||
public List<PasswordHistoryData> PasswordHistory { get; set; }
|
||||
public List<string> CollectionIds { get; set; }
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
public Enums.CipherRepromptType Reprompt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -30,6 +31,7 @@ namespace Bit.Core.Models.Domain
|
||||
RevisionDate = obj.RevisionDate;
|
||||
CollectionIds = obj.CollectionIds != null ? new HashSet<string>(obj.CollectionIds) : null;
|
||||
LocalData = localData;
|
||||
Reprompt = obj.Reprompt;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
@@ -75,8 +77,8 @@ namespace Bit.Core.Models.Domain
|
||||
public List<Field> Fields { get; set; }
|
||||
public List<PasswordHistory> PasswordHistory { get; set; }
|
||||
public HashSet<string> CollectionIds { get; set; }
|
||||
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
public CipherRepromptType Reprompt { get; set; }
|
||||
|
||||
public async Task<CipherView> DecryptAsync()
|
||||
{
|
||||
@@ -167,7 +169,8 @@ namespace Bit.Core.Models.Domain
|
||||
RevisionDate = RevisionDate,
|
||||
Type = Type,
|
||||
CollectionIds = CollectionIds.ToList(),
|
||||
DeletedDate = DeletedDate
|
||||
DeletedDate = DeletedDate,
|
||||
Reprompt = Reprompt,
|
||||
};
|
||||
BuildDataModel(this, c, new HashSet<string>
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Bit.Core.Models.Request
|
||||
Notes = cipher.Notes?.EncryptedString;
|
||||
Favorite = cipher.Favorite;
|
||||
LastKnownRevisionDate = cipher.RevisionDate;
|
||||
Reprompt = cipher.Reprompt;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
@@ -121,5 +122,6 @@ namespace Bit.Core.Models.Request
|
||||
public Dictionary<string, string> Attachments { get; set; }
|
||||
public Dictionary<string, AttachmentRequest> Attachments2 { get; set; }
|
||||
public DateTime LastKnownRevisionDate { get; set; }
|
||||
public CipherRepromptType Reprompt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -26,5 +27,6 @@ namespace Bit.Core.Models.Response
|
||||
public List<PasswordHistoryResponse> PasswordHistory { get; set; }
|
||||
public List<string> CollectionIds { get; set; }
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
public CipherRepromptType Reprompt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Bit.Core.Models.View
|
||||
public string ExpYear { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string MaskedCode => Code != null ? new string('•', Code.Length) : null;
|
||||
public string MaskedNumber => Number != null ? new string('•', Number.Length) : null;
|
||||
|
||||
public string Brand
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Bit.Core.Models.View
|
||||
CollectionIds = c.CollectionIds;
|
||||
RevisionDate = c.RevisionDate;
|
||||
DeletedDate = c.DeletedDate;
|
||||
Reprompt = c.Reprompt;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@@ -47,7 +48,7 @@ namespace Bit.Core.Models.View
|
||||
public HashSet<string> CollectionIds { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
|
||||
public CipherRepromptType Reprompt { get; set; }
|
||||
|
||||
public string SubTitle
|
||||
{
|
||||
|
||||
@@ -180,7 +180,8 @@ namespace Bit.Core.Services
|
||||
OrganizationId = model.OrganizationId,
|
||||
Type = model.Type,
|
||||
CollectionIds = model.CollectionIds,
|
||||
RevisionDate = model.RevisionDate
|
||||
RevisionDate = model.RevisionDate,
|
||||
Reprompt = model.Reprompt
|
||||
};
|
||||
|
||||
if (key == null && cipher.OrganizationId != null)
|
||||
|
||||
@@ -23,14 +23,13 @@ namespace Bit.Core.Utilities
|
||||
var platformUtilsService = Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||
var storageService = Resolve<IStorageService>("storageService");
|
||||
var secureStorageService = Resolve<IStorageService>("secureStorageService");
|
||||
var cryptoPrimitiveService = Resolve<ICryptoPrimitiveService>("cryptoPrimitiveService");
|
||||
var i18nService = Resolve<II18nService>("i18nService");
|
||||
var messagingService = Resolve<IMessagingService>("messagingService");
|
||||
var cryptoFunctionService = Resolve<ICryptoFunctionService>("cryptoFunctionService");
|
||||
var cryptoService = Resolve<ICryptoService>("cryptoService");
|
||||
SearchService searchService = null;
|
||||
|
||||
var stateService = new StateService();
|
||||
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
|
||||
var cryptoService = new CryptoService(storageService, secureStorageService, cryptoFunctionService);
|
||||
var tokenService = new TokenService(storageService);
|
||||
var apiService = new ApiService(tokenService, platformUtilsService, (bool expired) =>
|
||||
{
|
||||
@@ -75,8 +74,6 @@ namespace Bit.Core.Utilities
|
||||
var eventService = new EventService(storageService, apiService, userService, cipherService);
|
||||
|
||||
Register<IStateService>("stateService", stateService);
|
||||
Register<ICryptoFunctionService>("cryptoFunctionService", cryptoFunctionService);
|
||||
Register<ICryptoService>("cryptoService", cryptoService);
|
||||
Register<ITokenService>("tokenService", tokenService);
|
||||
Register<IApiService>("apiService", apiService);
|
||||
Register<IAppIdService>("appIdService", appIdService);
|
||||
|
||||
Reference in New Issue
Block a user