Skip to content

Commit

Permalink
Allow blank passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Apr 11, 2017
1 parent 39684c7 commit e636075
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions HomeAssistant/Views/SettingsViewController.swift
Expand Up @@ -28,7 +28,7 @@ class SettingsViewController: FormViewController {
var showErrorConnectingMessageError: Error?

var baseURL: URL?
var password: String?
var password: String = ""

let discovery = Bonjour()

Expand Down Expand Up @@ -153,15 +153,15 @@ class SettingsViewController: FormViewController {
$0.value = self.password
$0.placeholder = L10n.Settings.ConnectionSection.ApiPasswordRow.placeholder
}.onChange { row in
self.password = row.value
self.password = row.value!
}

<<< ButtonRow("connect") {
$0.title = "Save"
}.onCellSelection { _, row in
firstly {
HomeAssistantAPI.sharedInstance.Setup(baseURL: self.baseURL!.absoluteString,
password: self.password!)
password: self.password)
}.then {_ in
HomeAssistantAPI.sharedInstance.Connect()
}.then { config -> Void in
Expand All @@ -171,8 +171,8 @@ class SettingsViewController: FormViewController {
if let url = self.baseURL {
self.keychain["baseURL"] = url.absoluteString
}
if let password = self.password {
self.keychain["apiPassword"] = password
if self.password != "" {
self.keychain["apiPassword"] = self.password
}
self.form.setValues(["locationName": config.LocationName, "version": config.Version])
let locationNameRow: LabelRow = self.form.rowBy(tag: "locationName")!
Expand Down

0 comments on commit e636075

Please sign in to comment.