Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #1359: Updating modals to include site host
Browse files Browse the repository at this point in the history
  • Loading branch information
jumde committed Aug 13, 2019
1 parent f96dad3 commit ac4565e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Client/U2FExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class U2FExtensions: NSObject {

/// Show to enter key's pin
fileprivate let pinVerificationPopup = AlertPopupView(imageView: UIImageView(image: #imageLiteral(resourceName: "enter_pin")),
title: Strings.pinTitle, message: "",
title: Strings.pinTitle, message: Strings.pinMessage,
inputType: .default, secureInput: true,
inputPlaceholder: Strings.pinPlaceholder)

Expand Down Expand Up @@ -650,6 +650,8 @@ class U2FExtensions: NSObject {

// This modal is presented when FIDO/FIDO2 APIs are waiting for the security key
private func presentInsertKeyModal() {
let currentURL = self.tab?.url?.host ?? ""
insertKeyPopup.update(title: Strings.insertKeyMessage + currentURL)
insertKeyPopup.showWithType(showType: .flyUp)
}

Expand All @@ -665,6 +667,8 @@ class U2FExtensions: NSObject {

// The modal should be visible for the tab where the U2F API is active
if u2fActive && tab?.id == currentTabId && (fido2Service.keyState == .touchKey || u2fService.keyState == .YKFKeyU2FServiceKeyStateTouchKey) {
let currentURL = self.tab?.url?.host ?? ""
touchKeyPopup.update(title: Strings.touchKeyMessage + currentURL)
touchKeyPopup.showWithType(showType: .flyUp)
return
}
Expand All @@ -677,6 +681,9 @@ class U2FExtensions: NSObject {
self?.verificationPendingPopup.showWithType(showType: .flyUp)
return self?.verifyPin(completion: completion) ?? .flyDown
}

let currentURL = self.tab?.url?.host ?? ""
self.pinVerificationPopup.update(title: Strings.pinTitle + currentURL)
self.pinVerificationPopup.showWithType(showType: .flyUp)
}
}
Expand Down Expand Up @@ -1173,13 +1180,14 @@ extension Strings {
public static let U2FAuthenticationError = NSLocalizedString("U2FAuthenticationError", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Error authenticating your security key", comment: "Error handling U2F authentication.") + tryAgain

//Lightning Modals
public static let touchKeyMessage = NSLocalizedString("touchKeyMessage", bundle: Bundle.shared, value: "Touch your key to finish.", comment: "Message for touch key modal.")
public static let insertKeyMessage = NSLocalizedString("insertKeyMessage", bundle: Bundle.shared, value: "Insert your security key.", comment: "Message for touch key modal.")
public static let touchKeyMessage = NSLocalizedString("touchKeyMessage", bundle: Bundle.shared, value: "Touch key to finish request for ", comment: "Message for touch key modal.")
public static let insertKeyMessage = NSLocalizedString("insertKeyMessage", bundle: Bundle.shared, value: "Insert your security key for ", comment: "Message for touch key modal.")
public static let keyCancel = NSLocalizedString("touchKeyCancel", bundle: Bundle.shared, value: "Cancel", comment: "Text for touch key modal button.")

//PIN
public static let pinTitle = NSLocalizedString("pinTitle", bundle: Bundle.shared, value: "PIN verification required", comment: "Title for the alert modal when a security key with PIN is inserted.")
public static let pinPlaceholder = NSLocalizedString("pinPlaceholder", bundle: Bundle.shared, value: "Enter your security key PIN", comment: "Placeholder text for PIN")
public static let pinTitle = NSLocalizedString("pinTitle", bundle: Bundle.shared, value: "PIN verification for ", comment: "Title for the alert modal when a security key with PIN is inserted.")
public static let pinMessage = NSLocalizedString("pinMessage", bundle: Bundle.shared, value: "Enter the PIN for your security key", comment: "Placeholder text for PIN")
public static let pinPlaceholder = NSLocalizedString("pinPlaceholder", bundle: Bundle.shared, value: "PIN", comment: "Placeholder text for PIN")
public static let confirmPin = NSLocalizedString("confirmPin", bundle: Bundle.shared, value: "Verify", comment: "Button text to confirm PIN")
public static let verificationPending = NSLocalizedString("verificationPending", bundle: Bundle.shared, value: "Verifying your PIN...", comment: "Title when PIN code is being verified.")
}
Expand Down

0 comments on commit ac4565e

Please sign in to comment.