mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
support login uris from app extension
This commit is contained in:
parent
b6a3a0a54f
commit
8fc95759ba
2 changed files with 28 additions and 4 deletions
|
@ -160,12 +160,23 @@ namespace Bit.iOS.Extension
|
|||
Type = App.Enums.CipherType.Login,
|
||||
Login = new Login
|
||||
{
|
||||
Uri = string.IsNullOrWhiteSpace(UriCell.TextField.Text) ? null : UriCell.TextField.Text.Encrypt(),
|
||||
Uris = null,
|
||||
Username = string.IsNullOrWhiteSpace(UsernameCell.TextField.Text) ? null : UsernameCell.TextField.Text.Encrypt(),
|
||||
Password = string.IsNullOrWhiteSpace(PasswordCell.TextField.Text) ? null : PasswordCell.TextField.Text.Encrypt()
|
||||
}
|
||||
};
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(UriCell.TextField.Text))
|
||||
{
|
||||
cipher.Login.Uris = new List<LoginUri>
|
||||
{
|
||||
new LoginUri
|
||||
{
|
||||
Uri = UriCell.TextField.Text.Encrypt()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var saveTask = _cipherService.SaveAsync(cipher);
|
||||
var loadingAlert = Dialogs.CreateLoadingAlert(AppResources.Saving);
|
||||
PresentViewController(loadingAlert, true, null);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Bit.App.Models;
|
||||
using Bit.App.Enums;
|
||||
using Bit.App.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -13,7 +14,7 @@ namespace Bit.iOS.Extension.Models
|
|||
Name = cipher.Name?.Decrypt(cipher.OrganizationId);
|
||||
Username = cipher.Login?.Username?.Decrypt(cipher.OrganizationId);
|
||||
Password = cipher.Login?.Password?.Decrypt(cipher.OrganizationId);
|
||||
Uri = cipher.Login?.Uri?.Decrypt(cipher.OrganizationId);
|
||||
Uris = cipher.Login?.Uris?.Select(u => new LoginUriModel(u, cipher.OrganizationId));
|
||||
Totp = new Lazy<string>(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId));
|
||||
Fields = new Lazy<List<Tuple<string, string>>>(() =>
|
||||
{
|
||||
|
@ -37,8 +38,20 @@ namespace Bit.iOS.Extension.Models
|
|||
public string Name { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Uri { get; set; }
|
||||
public IEnumerable<LoginUriModel> Uris { get; set; }
|
||||
public Lazy<string> Totp { get; set; }
|
||||
public Lazy<List<Tuple<string, string>>> Fields { get; set; }
|
||||
|
||||
public class LoginUriModel
|
||||
{
|
||||
public LoginUriModel(LoginUri data, string orgId)
|
||||
{
|
||||
Uri = data?.Uri?.Decrypt(orgId);
|
||||
Match = data?.Match;
|
||||
}
|
||||
|
||||
public string Uri { get; set; }
|
||||
public UriMatchType? Match { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue