Changes for page Registration

Last modified by teamwire004 on 2025/04/01 07:23

From version 2.1
edited by teamwire004
on 2024/01/16 09:32
Change comment: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/14.10.13]
To version 3.1
edited by teamwire004
on 2024/07/12 13:06
Change comment: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/15.10.10]

Summary

Details

Page properties
Content
... ... @@ -18,8 +18,8 @@
18 18   ## If this document is changed such that it must have programming permission in order to run, change this to false.
19 19   #set($sandbox = true)
20 20   ##
21 - ## Load the configuration from a seperate document.
22 - #loadConfig('XWiki.RegistrationConfig')
21 + #set ($registrationConfig = $NULL)
22 + #_loadConfig($registrationConfig)
23 23   ##
24 24   #*
25 25   * You may include this document in other documents using {{include reference="XWiki.Registration"/}}
... ... @@ -125,7 +125,8 @@
125 125   'label' : $services.localization.render('core.register.firstName'),
126 126   'params' : {
127 127   'type' : 'text',
128 - 'size' : '60'
128 + 'size' : '60',
129 + 'autocomplete' : 'given-name'
129 129   }
130 130   })
131 131   #set($discard = $fields.add($field))
... ... @@ -136,7 +136,8 @@
136 136   'label' : $services.localization.render('core.register.lastName'),
137 137   'params' : {
138 138   'type' : 'text',
139 - 'size' : '60'
140 + 'size' : '60',
141 + 'autocomplete' : 'family-name'
140 140   }
141 141   })
142 142   #set($discard = $fields.add($field))
... ... @@ -148,7 +148,8 @@
148 148   'params' : {
149 149   'type' : 'text',
150 150   'onfocus' : 'prepareName(document.forms.register);',
151 - 'size' : '60'
153 + 'size' : '60',
154 + 'autocomplete' : 'username'
152 152   },
153 153   'validate' : {
154 154   'mandatory' : {
... ... @@ -171,7 +171,7 @@
171 171   ##
172 172   ##The password field, mandatory and must be at least 6 characters long.
173 173   ##The confirm password field, mandatory, must match password field, and must also be 6+ characters long.
174 - #definePasswordFields($fields, 'register_password', 'register2_password', $passwordOptions)
177 + #definePasswordFields($fields, 'register_password', 'register2_password', $registrationConfig.passwordOptions)
175 175   ##
176 176   ## The email address field, regex checked with an email pattern. Mandatory if registration uses email verification
177 177   #set($field =
... ... @@ -179,7 +179,8 @@
179 179   'label' : $services.localization.render('core.register.email'),
180 180   'params' : {
181 181   'type' : 'text',
182 - 'size' : '60'
185 + 'size' : '60',
186 + 'autocomplete' : 'email'
183 183   },
184 184   'validate' : {
185 185   'regex' : {
... ... @@ -188,7 +188,7 @@
188 188   }
189 189   }
190 190   })
191 - #if($xwiki.getXWikiPreferenceAsInt('use_email_verification', 0) == 1)
195 + #if($registrationConfig.useEmailVerification)
192 192   #set($field.validate.mandatory = {'failureMessage' : $services.localization.render('core.validation.required.message')})
193 193   #end
194 194   #set($discard = $fields.add($field))
... ... @@ -234,7 +234,7 @@
234 234   #if($services.captcha
235 235   && !$invited
236 236   && $xcontext.getUser() == "XWiki.XWikiGuest"
237 - && $requireCaptcha)
241 + && $registrationConfig.requireCaptcha)
238 238   ## The CAPTCHA field, programmatically checked to make sure the CAPTCHA is right.
239 239   ## Not checked by javascript because javascript can't check the CAPTCHA and the Ok message because it passes the
240 240   ## mandatory test is misleading.
... ... @@ -295,7 +295,7 @@
295 295   #end
296 296   ##
297 297   ## Display the heading
298 - $heading
302 + $registrationConfig.heading
299 299   ## If the submit button has been pressed, then we test the input and maybe create the user.
300 300   #if($request.getParameter('xwikiname'))
301 301   ## Do server side validation of input fields.
... ... @@ -309,7 +309,7 @@
309 309   ## If the registration was not successful or if the user hasn't submitted the info yet
310 310   ## Then we display the registration form.
311 311   #if(!$registrationDone)
312 - $welcomeMessage
316 + $registrationConfig.welcomeMessage
313 313  
314 314   {{html clean="false"}}
315 315   <form id="register" action="$xwiki.relativeRequestURL" method="post" class="xform half">
... ... @@ -377,6 +377,9 @@
377 377   {{translation key="core.register.userAlreadyExists"/}}
378 378   #elseif($reg == -4)
379 379   {{translation key="core.register.invalidUsername"/}}
384 + #elseif ($reg == -9)
385 + {{translation key="core.register.invalidCaptcha"/}}
386 + ## Note that -10 is reserved already (see api.XWiki#createUser)
380 380   #elseif($reg == -11)
381 381   {{translation key="core.register.mailSenderWronglyConfigured"/}}
382 382   #else
... ... @@ -404,16 +404,16 @@
404 404   #if("$!request.getParameter($redirectParam)" != '')
405 405   #set($redirect = $request.getParameter($redirectParam))
406 406   #else
407 - #set($redirect = $defaultRedirect)
414 + #set($redirect = $registrationConfig.defaultRedirect)
408 408   #end
409 409   ## Display a "registration successful" message
410 410  
411 - #evaluate($registrationSuccessMessage)
418 + #evaluate($registrationConfig.registrationSuccessMessage)
412 412  
413 413   ## Empty line prevents message from being forced into a <p> block.
414 414  
415 415   ## Give the user a login button which posts their username and password to loginsubmit
416 - #if($loginButton)
423 + #if($registrationConfig.loginButton)
417 417  
418 418   {{html clean=false wiki=false}}
419 419   <form id="loginForm" action="$loginURL" method="post">
... ... @@ -428,7 +428,7 @@
428 428   </div>
429 429   </form>
430 430   ## We don't want autoLogin if we are administrators adding users...
431 - #if ($autoLogin && $request.xpage != 'registerinline')
438 + #if ($registrationConfig.autoLogin && $request.xpage != 'registerinline')
432 432   <script>
433 433   document.observe('xwiki:dom:loaded', function() {
434 434   document.forms['loginForm'].submit();
registrationSuccessMessage
Restricted
... ... @@ -1,0 +1,1 @@
1 +0
welcomeMessage
Restricted
... ... @@ -1,0 +1,1 @@
1 +0
liveValidation_defaultFieldOkMessage
Number
... ... @@ -1,1 +1,0 @@
1 -4
Size
... ... @@ -1,1 +1,0 @@
1 -30
Pretty Name
... ... @@ -1,1 +1,0 @@
1 -Default field okay message
Name
... ... @@ -1,1 +1,0 @@
1 -liveValidation_defaultFieldOkMessage
Use Suggest
... ... @@ -1,1 +1,0 @@
1 -0
liveValidation_enabled
Number
... ... @@ -1,1 +1,0 @@
1 -3
Pretty Name
... ... @@ -1,1 +1,0 @@
1 -Enable Javascript field validation
Name
... ... @@ -1,1 +1,0 @@
1 -liveValidation_enabled
Display Form Type
... ... @@ -1,1 +1,0 @@
1 -checkbox