Skip to content

Commit

Permalink
Add newpassword layout type
Browse files Browse the repository at this point in the history
Now we have a layout that will be used to request a password change from
the user after authentication.
  • Loading branch information
denisonbarbosa committed Aug 9, 2023
1 parent f46ab4a commit 6b7cbbe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/brokers/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ func validateUILayout(layout map[string]string) (r map[string]string, err error)
r["label"] = label
r["entry"] = entry
r["button"] = button
case "newpassword":
if label == "" {
return nil, fmt.Errorf("'label' is required")
}
if !slices.Contains([]string{"chars", "digits", "chars_password", "digits_password"}, entry) {
return nil, fmt.Errorf("'entry' does not match allowed values for this type: %v", entry)
}
r["label"] = label
r["entry"] = entry
r["button"] = button
case "webview":
default:
return nil, fmt.Errorf("invalid layout option: type is required, got: %v", layout)
Expand Down

0 comments on commit 6b7cbbe

Please sign in to comment.