Login form - Nesting if logic inside of form errors

Hi All,

Doing some refactoring of the login page and I keep getting “Liquid syntax error: ‘endif’ is not a valid delimiter for form tags. use endform”.

All of the logic appears correct to me. If I remove one of the three if statements below it just moves to the next one and says the same error.

Proposed login page:


             

              

                   # {{ 'customer.login.title' | t }}
              

            

            {% form 'customer_login' %}
            {{ form.errors | default_errors }}
           
              
              
                    {% if form.password_needed %}
                    
                    
                    {% endif %}
              

                 
              

              
                 

                    - {{ 'layout.customer.create_account' | t }}

                    - Go Back

                    - {% if form.password_needed %}{{ 'customer.login.forgot_password' | t }}{% endif %}
                 

              

           

             {% endform %}
          

          
             

                

                   ## {{ 'customer.recover_password.title' | t }}
                

                

{{ 'customer.recover_password.subtext' | t }}

             

             
                {% form 'recover_customer_password' %}
                {{ form.errors | default_errors }}
                {% if form.posted_successfully? %}
                
                {% endif %}
                
                
                

                   
                

                
                   
                

                {% endform %}
             

             
                

                   {% if shop.checkout.guest_login %}
                   ## {{ 'customer.login.guest_title' | t }}
                   {% form 'guest_login' %}
                   
                      
                   

                   {% endform %}
                   {% endif %}
                

             

          

For reference this is the current login page which is structured almost identically.


         

            {% form 'customer_login' %}
            
            {{ form.errors | default_errors }}
            
            
            {% if form.password_needed %}
            
            
            {% endif %}
            
            

               - {{ 'layout.customer.create_account' | t }}

               - Go Back

               - {% if form.password_needed %}{{ 'customer.login.forgot_password' | t }}{% endif %}
            

            {% endform %}
         

      

Fixed. Oops!

the first endif had a space between % and } breaking it there