Look for "login" as a username field in auto fill
- Will look for "username" first
This commit is contained in:
parent
69b58e686d
commit
39820a4108
3 changed files with 23 additions and 6 deletions
|
|
@ -261,6 +261,9 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
if let username = password.getUsername() {
|
if let username = password.getUsername() {
|
||||||
section.item.append(TableCell(title: "username", content: username))
|
section.item.append(TableCell(title: "username", content: username))
|
||||||
}
|
}
|
||||||
|
if let login = password.getLogin() {
|
||||||
|
section.item.append(TableCell(title: "login", content: login))
|
||||||
|
}
|
||||||
section.item.append(TableCell(title: "password", content: password.password))
|
section.item.append(TableCell(title: "password", content: password.password))
|
||||||
tableData.append(section)
|
tableData.append(section)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
var decryptedPassword: Password?
|
var decryptedPassword: Password?
|
||||||
do {
|
do {
|
||||||
decryptedPassword = try self.passwordStore.decrypt(passwordEntity: passwordEntity, requestPGPKeyPassphrase: self.requestPGPKeyPassphrase)
|
decryptedPassword = try self.passwordStore.decrypt(passwordEntity: passwordEntity, requestPGPKeyPassphrase: self.requestPGPKeyPassphrase)
|
||||||
let username = decryptedPassword?.getUsername() ?? ""
|
let username = decryptedPassword?.getUsername() ?? decryptedPassword?.getLogin() ?? ""
|
||||||
let password = decryptedPassword?.password ?? ""
|
let password = decryptedPassword?.password ?? ""
|
||||||
DispatchQueue.main.async {// prepare a dictionary to return
|
DispatchQueue.main.async {// prepare a dictionary to return
|
||||||
switch self.extensionAction {
|
switch self.extensionAction {
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class Password {
|
||||||
public func getFilteredAdditions() -> [String: String] {
|
public func getFilteredAdditions() -> [String: String] {
|
||||||
var filteredAdditions = [String: String]()
|
var filteredAdditions = [String: String]()
|
||||||
additions.forEach { (key: String, value: String) in
|
additions.forEach { (key: String, value: String) in
|
||||||
if key.lowercased() != "username" && key.lowercased() != "password" &&
|
if key.lowercased() != "username" && key.lowercased() != "login" && key.lowercased() != "password" &&
|
||||||
(!key.hasPrefix("unknown") || !SharedDefaults[.isHideUnknownOn]) &&
|
(!key.hasPrefix("unknown") || !SharedDefaults[.isHideUnknownOn]) &&
|
||||||
(!Password.otpKeywords.contains(key) || !SharedDefaults[.isHideOTPOn]) {
|
(!Password.otpKeywords.contains(key) || !SharedDefaults[.isHideOTPOn]) {
|
||||||
filteredAdditions[key] = value
|
filteredAdditions[key] = value
|
||||||
|
|
@ -132,11 +132,15 @@ public class Password {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getUsername() -> String? {
|
public func getUsername() -> String? {
|
||||||
return getAdditionValue(withKey: "Username") ?? getAdditionValue(withKey: "username")
|
return getAdditionValue(withKey: "username", caseSensitive: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getLogin() -> String? {
|
||||||
|
return getAdditionValue(withKey: "login", caseSensitive: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getURLString() -> String? {
|
public func getURLString() -> String? {
|
||||||
return getAdditionValue(withKey: "URL") ?? getAdditionValue(withKey: "url") ?? getAdditionValue(withKey: "Url")
|
return getAdditionValue(withKey: "url", caseSensitive: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a key-value pair from the line
|
// return a key-value pair from the line
|
||||||
|
|
@ -181,8 +185,18 @@ public class Password {
|
||||||
return getPlainText().data(using: .utf8)!
|
return getPlainText().data(using: .utf8)!
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getAdditionValue(withKey key: String) -> String? {
|
private func getAdditionValue(withKey key: String, caseSensitive: Bool = true) -> String? {
|
||||||
return self.additions[key]
|
if caseSensitive {
|
||||||
|
return additions[key]
|
||||||
|
} else {
|
||||||
|
let searchKey = key.lowercased()
|
||||||
|
for k in additions.keys {
|
||||||
|
if searchKey == k.lowercased() {
|
||||||
|
return additions[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue