validate_registration_form

NAML documentation   Watch a video
   Usages of this macro
... in validate_registration_form.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<override_macro name="validate_registration_form">  
    <n.comment
Macro
Parameters: text
.>Do  not let people register unless in Members group</n.comment.> 
    <n.users_in_group
Binary
Namespace: NabbleNamespace
Parameters: do, group
. group="Members">  
        <n.set_var
Binary
Namespace: BasicNamespace
Parameters: name, value
. name="in_members">  
            <n.loop
Macro
Requires: sequence
Parameters: by, do
.>              
                <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.equal
Binary
Namespace: BasicNamespace
Parameters: value2, value1
 value1="[n.to_lower_case
Binary
Namespace: BasicNamespace
Parameters: text
.email_field
Macro
Parameters: do
.value
Binary
Namespace: FieldNamespace
/]" value2="[n.to_lower_case
Binary
Namespace: BasicNamespace
Parameters: text
.current_user
Binary
Namespace: UserList
Parameters: do
.user_email
Binary
Namespace: UserNamespace
/]">    
                    <then>true<n.break
Binary
Namespace: BasicNamespace
/></then>  
                </n.if.equal>              
            </n.loop.>  
        </n.set_var.>  
        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_empty
Binary
Namespace: BasicNamespace
Parameters: value
.remove_spaces
Macro
Parameters: text
.var
Binary
Namespace: BasicNamespace
Parameters: name
 name="in_members">  
            <then.throw_template_exception
Binary
Namespace: BasicNamespace
Parameters: name
 name="user_is_not_member" />  
        </n.if.is_empty.remove_spaces.var>  
    </n.users_in_group.>  
    
    <n.user_name_field
Macro
Parameters: do
.notify_if_empty
Macro
Requires: field
/>  
    <n.email_field
Macro
Parameters: do
.notify_if_empty
Macro
Requires: field
/>  
    <n.password_field
Macro
Parameters: do
.notify_if_empty
Macro
Requires: field
/>  
    <n.password2_field
Macro
Parameters: do
.notify_if_empty
Macro
Requires: field
/>  
    
    <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.equal
Binary
Namespace: BasicNamespace
Parameters: value2, value1
 value1="[n.password_field
Macro
Parameters: do
.value
Binary
Namespace: FieldNamespace
/]" value2="[n.password2_field
Macro
Parameters: do
.value
Binary
Namespace: FieldNamespace
/]">  
        <then.throw_template_exception
Binary
Namespace: BasicNamespace
Parameters: name
 name="passwords_dont_match"/>  
    </n.if.not.equal>    
    
    <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.accept_terms_field
Macro
Parameters: do
.is_checked
Macro
Requires: field
>  
        <then.throw_template_exception
Binary
Namespace: BasicNamespace
Parameters: name
 name="must_accept_terms_of_use"/>  
    </n.if.not.accept_terms_field.is_checked>  
    
</override_macro>
Overrides default macro
... in register.naml
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<macro name="validate_registration_form">
    <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>
</macro>