Skip to content

Commit

Permalink
Fix SSO in Database with allow option (#450)
Browse files Browse the repository at this point in the history
* Fix SSO in Database with allow option

* Use currentscreen in conditional
  • Loading branch information
cocojoe authored Aug 9, 2017
1 parent 138ea8d commit 28cfabd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Lock/DatabasePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,14 @@ class DatabasePresenter: Presentable, Loggable {
try self.authenticator.update(attribute, value: input.text)
input.showValid()

guard
let mode = self.databaseView?.switcher?.selected,
mode == .login && updateHRD
else { return }
try? self.enterpriseInteractor?.updateEmail(input.text)
if let connection = self.enterpriseInteractor?.connection {
self.logger.verbose("Enterprise connection detected: \(connection)")
if self.databaseView?.ssoBar == nil { self.databaseView?.presentEnterprise() }
} else {
self.databaseView?.removeEnterprise()
if self.currentScreen == .login && updateHRD {
try? self.enterpriseInteractor?.updateEmail(input.text)
if let connection = self.enterpriseInteractor?.connection {
self.logger.verbose("Enterprise connection detected: \(connection)")
if self.databaseView?.ssoBar == nil { self.databaseView?.presentEnterprise() }
} else {
self.databaseView?.removeEnterprise()
}
}
} catch let error as InputValidationError {
input.showError(error.localizedMessage(withConnection: self.database))
Expand Down

0 comments on commit 28cfabd

Please sign in to comment.