Skip to content

Commit d0235a1

Browse files
KM-17445: skip showing username+password
when we don't know the password there's no point in showing it
1 parent 32fe5d1 commit d0235a1

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

LocalPackages/PIALibrary/Sources/PIALibrary/Account/DefaultAccountProvider.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public final class DefaultAccountProvider: AccountProvider, ConfigurationAccess,
119119
guard let username = accessedDatabase.secure.username() else {
120120
return nil
121121
}
122-
// TODO: do we need this???
123122
let password = accessedDatabase.secure.password(for: username) ?? ""
124123
return UserAccount(
125124
credentials: Credentials(username: username, password: password),

PIA VPN/UI/ConfirmVPNPlanViewController.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ final class ConfirmVPNPlanViewController: AutolayoutViewController, BrandableNav
135135

136136
let alert = Macros.alert(L10n.Signup.Unreachable.vcTitle, L10n.Welcome.Update.Account.Email.error)
137137
alert.addActionWithTitle(L10n.Global.close) {
138-
self?.perform(segue: StoryboardSegue.Signup.successShowCredentialsSegueIdentifier)
138+
self?.onSuccess(password: password)
139139
}
140140
self?.present(alert, animated: true, completion: nil)
141141

@@ -144,7 +144,20 @@ final class ConfirmVPNPlanViewController: AutolayoutViewController, BrandableNav
144144

145145
log.debug("Account: Email successfully modified")
146146
self?.textEmail.endEditing(true)
147-
self?.perform(segue: StoryboardSegue.Signup.successShowCredentialsSegueIdentifier)
147+
self?.onSuccess(password: password)
148+
}
149+
}
150+
151+
private func onSuccess(password: String) {
152+
if password.isEmpty {
153+
// we skip the screen showing username+password
154+
guard let user = config.metadata.user else {
155+
log.error("User account not set in metadata")
156+
return
157+
}
158+
config.completionDelegate?.welcomeDidSignup(withUser: user, topViewController: self)
159+
} else {
160+
perform(segue: StoryboardSegue.Signup.successShowCredentialsSegueIdentifier)
148161
}
149162
}
150163

0 commit comments

Comments
 (0)