From e3697719d21d781b519c65e177208f3d84d27937 Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Tue, 1 Oct 2024 11:19:43 +0200 Subject: [PATCH] twofactor_enforced: Make template work with nil values --- templates/application/config.php.erb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/templates/application/config.php.erb b/templates/application/config.php.erb index 09dee08..ec36ad8 100644 --- a/templates/application/config.php.erb +++ b/templates/application/config.php.erb @@ -214,18 +214,22 @@ $CONFIG = array ( array ( 0 => 'admin', 1 => 'forcemfa', - <%- index = 2 -%> - <%- @twofactor_enforced_groups.each do |item| -%> + <%- if @twofactor_enforced_groups -%> + <%- index = 2 -%> + <%- @twofactor_enforced_groups.each do |item| -%> <%= index %> => '<%= item %>', - <%- index += 1 -%> + <%- index += 1 -%> + <%- end -%> <%- end -%> ), 'twofactor_enforced_excluded_groups' => array ( - <%- index = 0 -%> - <%- @twofactor_enforced_excluded_groups.each do |item| -%> + <%- if @twofactor_enforced_excluded_groups -%> + <%- index = 0 -%> + <%- @twofactor_enforced_excluded_groups.each do |item| -%> <%= index %> => '<%= item %>', - <%- index += 1 -%> + <%- index += 1 -%> + <%- end -%> <%- end -%> ), 'updatechecker' => false,