Changes for page Registration

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

From version 1.1
edited by teamwire-admin
on 2020/08/26 13:09
Change comment: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/11.10.8]
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
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.teamwire-admin
1 +XWiki.teamwire004
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.
... ... @@ -255,17 +255,6 @@
255 255   })
256 256   #set($discard = $fields.add($field))
257 257   #end
258 - ##
259 - ## Pass the name of the template to $xwiki.createUser so any contained information will be passed in.
260 - #set($field =
261 - {'name' : 'template',
262 - 'params' : {
263 - 'type' : 'hidden',
264 - 'value' : 'XWiki.XWikiUserTemplate'
265 - }
266 - })
267 - #set($discard = $fields.add($field))
268 - ##
269 269   ## Pass the redirect parameter on so that the login page may redirect to the right place.
270 270   ## Not necessary in Firefox 3.0.10 or Opera 9.64, I don't know about IE or Safari.
271 271   #set($field =
... ... @@ -306,7 +306,7 @@
306 306   #end
307 307   ##
308 308   ## Display the heading
309 - $heading
302 + $registrationConfig.heading
310 310   ## If the submit button has been pressed, then we test the input and maybe create the user.
311 311   #if($request.getParameter('xwikiname'))
312 312   ## Do server side validation of input fields.
... ... @@ -320,7 +320,7 @@
320 320   ## If the registration was not successful or if the user hasn't submitted the info yet
321 321   ## Then we display the registration form.
322 322   #if(!$registrationDone)
323 - $welcomeMessage
316 + $registrationConfig.welcomeMessage
324 324  
325 325   {{html clean="false"}}
326 326   <form id="register" action="$xwiki.relativeRequestURL" method="post" class="xform half">
... ... @@ -328,12 +328,12 @@
328 328   #if ($request.xpage == 'registerinline')
329 329   #skinExtensionHooks
330 330   #end
331 - <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
332 332   #set ($userDirectoryReference = $services.model.createDocumentReference('', 'Main', 'UserDirectory'))
333 333   #if ($xwiki.exists($userDirectoryReference))
334 334   <input type="hidden" name="parent" value="$!{services.model.serialize($userDirectoryReference, 'default')}" />
335 335   #end
336 336   </div>
329 + ## Note that the macro inject the form_token field.
337 337   #generateHtml($fields, $request)
338 338   <p class="buttons">
339 339   <span class="buttonwrapper">
... ... @@ -388,6 +388,9 @@
388 388   {{translation key="core.register.userAlreadyExists"/}}
389 389   #elseif($reg == -4)
390 390   {{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)
391 391   #elseif($reg == -11)
392 392   {{translation key="core.register.mailSenderWronglyConfigured"/}}
393 393   #else
... ... @@ -415,16 +415,16 @@
415 415   #if("$!request.getParameter($redirectParam)" != '')
416 416   #set($redirect = $request.getParameter($redirectParam))
417 417   #else
418 - #set($redirect = $defaultRedirect)
414 + #set($redirect = $registrationConfig.defaultRedirect)
419 419   #end
420 420   ## Display a "registration successful" message
421 421  
422 - #evaluate($registrationSuccessMessage)
418 + #evaluate($registrationConfig.registrationSuccessMessage)
423 423  
424 424   ## Empty line prevents message from being forced into a <p> block.
425 425  
426 426   ## Give the user a login button which posts their username and password to loginsubmit
427 - #if($loginButton)
423 + #if($registrationConfig.loginButton)
428 428  
429 429   {{html clean=false wiki=false}}
430 430   <form id="loginForm" action="$loginURL" method="post">
... ... @@ -439,8 +439,8 @@
439 439   </div>
440 440   </form>
441 441   ## We don't want autoLogin if we are administrators adding users...
442 - #if ($autoLogin && $request.xpage != 'registerinline')
443 - <script type='text/javascript'>
438 + #if ($registrationConfig.autoLogin && $request.xpage != 'registerinline')
439 + <script>
444 444   document.observe('xwiki:dom:loaded', function() {
445 445   document.forms['loginForm'].submit();
446 446   });
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