validate_registration_form.naml

<override_macro name="validate_registration_form">  
    <n.comment.>Do  not let people register unless in Members group</n.comment.> 
    <n.users_in_group. group="Members">  
        <n.set_var. name="in_members">  
            <n.loop.>              
                <n.if.equal value1="[n.to_lower_case.email_field.value/]" value2="[n.to_lower_case.current_user.user_email/]">    
                    <then>true<n.break/></then>  
                </n.if.equal>              
            </n.loop.>  
        </n.set_var.>  
        <n.if.is_empty.remove_spaces.var name="in_members">  
            <then.throw_template_exception name="user_is_not_member" />  
        </n.if.is_empty.remove_spaces.var>  
    </n.users_in_group.>  
    
    <n.user_name_field.notify_if_empty/>  
    <n.email_field.notify_if_empty/>  
    <n.password_field.notify_if_empty/>  
    <n.password2_field.notify_if_empty/>  
    
    <n.if.not.equal value1="[n.password_field.value/]" value2="[n.password2_field.value/]">  
        <then.throw_template_exception name="passwords_dont_match"/>  
    </n.if.not.equal>    
    
    <n.if.not.accept_terms_field.is_checked>  
        <then.throw_template_exception name="must_accept_terms_of_use"/>  
    </n.if.not.accept_terms_field.is_checked>  
    
</override_macro>