PWD-7: check for empty values before creation

This commit is contained in:
Markus Thielker 2025-01-24 17:49:56 +01:00
parent 737d904807
commit 083ca1f030
No known key found for this signature in database

View file

@ -37,6 +37,16 @@ struct AddPasswordView: View {
.font(.footnote)
HStack {
PwdButton(label: Text("Save")) {
if name.isEmpty || value.isEmpty {
let alert = NSAlert()
alert.messageText = "Missing values"
alert.informativeText = "Make sure to fill in both name and value!"
alert.addButton(withTitle: "Okay")
alert.runModal()
return
}
viewModel.createPassword(name: name, value: value)
name = ""
value = ""