Changes for page Registration

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

From 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]
To 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]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.teamwire004
1 +XWiki.teamwire-admin
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 - #set ($registrationConfig = $NULL)
22 - #_loadConfig($registrationConfig)
21 + ## Load the configuration from a seperate document.
22 + #loadConfig('XWiki.RegistrationConfig')
23 23   ##
24 24   #*
25 25   * You may include this document in other documents using {{include reference="XWiki.Registration"/}}
... ... @@ -125,8 +125,7 @@
125 125   'label' : $services.localization.render('core.register.firstName'),
126 126   'params' : {
127 127   'type' : 'text',
128 - 'size' : '60',
129 - 'autocomplete' : 'given-name'
128 + 'size' : '60'
130 130   }
131 131   })
132 132   #set($discard = $fields.add($field))
... ... @@ -137,8 +137,7 @@
137 137   'label' : $services.localization.render('core.register.lastName'),
138 138   'params' : {
139 139   'type' : 'text',
140 - 'size' : '60',
141 - 'autocomplete' : 'family-name'
139 + 'size' : '60'
142 142   }
143 143   })
144 144   #set($discard = $fields.add($field))
... ... @@ -150,8 +150,7 @@
150 150   'params' : {
151 151   'type' : 'text',
152 152   'onfocus' : 'prepareName(document.forms.register);',
153 - 'size' : '60',
154 - 'autocomplete' : 'username'
151 + 'size' : '60'
155 155   },
156 156   'validate' : {
157 157   'mandatory' : {
... ... @@ -174,7 +174,7 @@
174 174   ##
175 175   ##The password field, mandatory and must be at least 6 characters long.
176 176   ##The confirm password field, mandatory, must match password field, and must also be 6+ characters long.
177 - #definePasswordFields($fields, 'register_password', 'register2_password', $registrationConfig.passwordOptions)
174 + #definePasswordFields($fields, 'register_password', 'register2_password', $passwordOptions)
178 178   ##
179 179   ## The email address field, regex checked with an email pattern. Mandatory if registration uses email verification
180 180   #set($field =
... ... @@ -182,8 +182,7 @@
182 182   'label' : $services.localization.render('core.register.email'),
183 183   'params' : {
184 184   'type' : 'text',
185 - 'size' : '60',
186 - 'autocomplete' : 'email'
182 + 'size' : '60'
187 187   },
188 188   'validate' : {
189 189   'regex' : {
... ... @@ -192,7 +192,7 @@
192 192   }
193 193   }
194 194   })
195 - #if($registrationConfig.useEmailVerification)
191 + #if($xwiki.getXWikiPreferenceAsInt('use_email_verification', 0) == 1)
196 196   #set($field.validate.mandatory = {'failureMessage' : $services.localization.render('core.validation.required.message')})
197 197   #end
198 198   #set($discard = $fields.add($field))
... ... @@ -238,7 +238,7 @@
238 238   #if($services.captcha
239 239   && !$invited
240 240   && $xcontext.getUser() == "XWiki.XWikiGuest"
241 - && $registrationConfig.requireCaptcha)
237 + && $requireCaptcha)
242 242   ## The CAPTCHA field, programmatically checked to make sure the CAPTCHA is right.
243 243   ## Not checked by javascript because javascript can't check the CAPTCHA and the Ok message because it passes the
244 244   ## mandatory test is misleading.
... ... @@ -259,6 +259,17 @@
259 259   })
260 260   #set($discard = $fields.add($field))
261 261   #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 + ##
262 262   ## Pass the redirect parameter on so that the login page may redirect to the right place.
263 263   ## Not necessary in Firefox 3.0.10 or Opera 9.64, I don't know about IE or Safari.
264 264   #set($field =
... ... @@ -299,7 +299,7 @@
299 299   #end
300 300   ##
301 301   ## Display the heading
302 - $registrationConfig.heading
309 + $heading
303 303   ## If the submit button has been pressed, then we test the input and maybe create the user.
304 304   #if($request.getParameter('xwikiname'))
305 305   ## Do server side validation of input fields.
... ... @@ -313,7 +313,7 @@
313 313   ## If the registration was not successful or if the user hasn't submitted the info yet
314 314   ## Then we display the registration form.
315 315   #if(!$registrationDone)
316 - $registrationConfig.welcomeMessage
323 + $welcomeMessage
317 317  
318 318   {{html clean="false"}}
319 319   <form id="register" action="$xwiki.relativeRequestURL" method="post" class="xform half">
... ... @@ -321,12 +321,12 @@
321 321   #if ($request.xpage == 'registerinline')
322 322   #skinExtensionHooks
323 323   #end
331 + <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
324 324   #set ($userDirectoryReference = $services.model.createDocumentReference('', 'Main', 'UserDirectory'))
325 325   #if ($xwiki.exists($userDirectoryReference))
326 326   <input type="hidden" name="parent" value="$!{services.model.serialize($userDirectoryReference, 'default')}" />
327 327   #end
328 328   </div>
329 - ## Note that the macro inject the form_token field.
330 330   #generateHtml($fields, $request)
331 331   <p class="buttons">
332 332   <span class="buttonwrapper">
... ... @@ -381,9 +381,6 @@
381 381   {{translation key="core.register.userAlreadyExists"/}}
382 382   #elseif($reg == -4)
383 383   {{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)
387 387   #elseif($reg == -11)
388 388   {{translation key="core.register.mailSenderWronglyConfigured"/}}
389 389   #else
... ... @@ -411,16 +411,16 @@
411 411   #if("$!request.getParameter($redirectParam)" != '')
412 412   #set($redirect = $request.getParameter($redirectParam))
413 413   #else
414 - #set($redirect = $registrationConfig.defaultRedirect)
418 + #set($redirect = $defaultRedirect)
415 415   #end
416 416   ## Display a "registration successful" message
417 417  
418 - #evaluate($registrationConfig.registrationSuccessMessage)
422 + #evaluate($registrationSuccessMessage)
419 419  
420 420   ## Empty line prevents message from being forced into a <p> block.
421 421  
422 422   ## Give the user a login button which posts their username and password to loginsubmit
423 - #if($registrationConfig.loginButton)
427 + #if($loginButton)
424 424  
425 425   {{html clean=false wiki=false}}
426 426   <form id="loginForm" action="$loginURL" method="post">
... ... @@ -435,8 +435,8 @@
435 435   </div>
436 436   </form>
437 437   ## We don't want autoLogin if we are administrators adding users...
438 - #if ($registrationConfig.autoLogin && $request.xpage != 'registerinline')
439 - <script>
442 + #if ($autoLogin && $request.xpage != 'registerinline')
443 + <script type='text/javascript'>
440 440   document.observe('xwiki:dom:loaded', function() {
441 441   document.forms['loginForm'].submit();
442 442   });
liveValidation_defaultFieldOkMessage
Number
... ... @@ -1,0 +1,1 @@
1 +4
Size
... ... @@ -1,0 +1,1 @@
1 +30
Pretty Name
... ... @@ -1,0 +1,1 @@
1 +Default field okay message
Name
... ... @@ -1,0 +1,1 @@
1 +liveValidation_defaultFieldOkMessage
Use Suggest
... ... @@ -1,0 +1,1 @@
1 +0
liveValidation_enabled
Number
... ... @@ -1,0 +1,1 @@
1 +3
Pretty Name
... ... @@ -1,0 +1,1 @@
1 +Enable Javascript field validation
Name
... ... @@ -1,0 +1,1 @@
1 +liveValidation_enabled
Display Form Type
... ... @@ -1,0 +1,1 @@
1 +checkbox
registrationSuccessMessage
Restricted
... ... @@ -1,1 +1,0 @@
1 -0
welcomeMessage
Restricted
... ... @@ -1,1 +1,0 @@
1 -0