Mudanças do documento Esqueceu sua senha?
Última modificação por Luiz Fernando Casagrande em 2019/04/24 10:34
editado por Luiz Fernando Casagrande
em 2016/11/04 14:04
em 2016/11/04 14:04
editado por Luiz Fernando Casagrande
em 2019/04/24 10:34
em 2019/04/24 10:34
Comentário da mudança: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/10.11.6]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -35,6 +35,15 @@ 35 35 ## Check if the user exists and has a valid email address configured in his profile 36 36 #set ($userObj = '') 37 37 #set ($userObj = $userDoc.getObject('XWiki.XWikiUsers')) 38 + ## If local user does not exist check global user 39 + #if (!$userObj && ${xcontext.database} != ${xcontext.mainWikiName}) 40 + #if ($userName.indexOf('.') != -1) 41 + #set ($userDoc = $xwiki.getDocumentAsAuthor("${xcontext.mainWikiName}:${userName}")) 42 + #else 43 + #set ($userDoc = $xwiki.getDocumentAsAuthor("${xcontext.mainWikiName}:XWiki.${userName}")) 44 + #end 45 + #set ($userObj = $userDoc.getObject('XWiki.XWikiUsers')) 46 + #end 38 38 #if (!$userObj) 39 39 40 40 {{warning}}$services.localization.render('xe.admin.passwordReset.error.noUser', ["//${escapetool.xml($userName)}//"]){{/warning}} ... ... @@ -59,7 +59,8 @@ 59 59 #set ($discard = $verifObj.set('verification', $verifStr)) 60 60 #set ($discard = $userDoc.saveAsAuthor($services.localization.render('xe.admin.passwordReset.versionComment'), true)) 61 61 ## Compose the verification URL 62 - #set ($passwordResetURL = $xwiki.getDocument('XWiki.ResetPasswordComplete').getExternalURL('view', "u=${userName}&v=${verifStr}")) 71 + #set ($userDocRef = $escapetool.url($services.model.serialize($userDoc.documentReference, 'default'))) 72 + #set ($passwordResetURL = $xwiki.getDocument("XWiki.ResetPasswordComplete").getExternalURL('view', "u=${userDocRef}&v=${verifStr}")) 63 63 ## Send the email 64 64 #set ($from = $services.mailsender.configuration.fromAddress) 65 65 #if ("$!from" == '') ... ... @@ -84,7 +84,7 @@ 84 84 ## Check for an error constructing the message! 85 85 #if ($services.mailsender.lastError) 86 86 #displayError($exceptiontool.getStackTrace($services.mailsender.lastError)) 87 - #else 97 + #else 88 88 ## Send the message and wait for it to be sent or for any error to be raised. 89 89 #set ($mailResult = $services.mailsender.send([$message], 'database')) 90 90 ## Check for errors during the send