如何从管理员为新用户创建的Alfresco UI页面获取密码?

编程入门 行业动态 更新时间:2024-10-09 04:24:01
本文介绍了如何从管理员为新用户创建的Alfresco UI页面获取密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已使用此代码自动生成邮件。现在的问题是邮件中显示的密码是脚本生成的密码。我希望从露天新用户页面获取密码,其中管理员已为新用户创建了密码,而不是任何随机字符串。 以下是我为自动邮件生成而生成的脚本。

I had used this code for auto generation of mails. Now the problem is password shown in the mail is the password as generated by the script. I want the password to be fetched from alfresco new user page, where the admin has created the password for the new user not any random string. Below is the script that i generated for automatic mail generation.

if (document.isContainer && document.displayPath == "/Company Home/User Homes") { var owner = document.properties["cm:owner"]; var pNode = people.getPerson(owner); if (pNode!=null && pNode.exists()){ var userName = pNode.properties.userName; var email = pNode.properties.email; var randPassword = Math.random().toString(36).substr(2, 30)+"-"+(Date.now()); people.setPassword(userName, randPassword); logger.debug("Invitation mail: User "+userName+" password has been changed."); var mail = actions.create("mail"); //mail.parameters.from = "noreply@customdomain"; mail.parameters.to = email; mail.parameters.subject = "Welcome to the site, login: "+userName+", password: "+randPassword; mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Invite Email Templates/invite_user_email.ftl"); var templateModel = new Array(); templateModel['newPassword'] = randPassword; // use ${newPassword} expression inside template mail.parameters.template_model = templateModel; mail.executeAsynchronously(document); logger.debug("Invitation mail has been sent to "+email); } else { logger.warn("Invitation mail: User not found: "+owner); } }

请指导我进一步操作。

推荐答案

您无法从其哈希值中解密密码。您只能编码新密码并将其与哈希值匹配。

You can't decode password from its hash. You can only encode new password and match it with hash.

您可以修改Alfresco Share,以将原始密码存储在自定义用户方面,但这是非常糟糕的做法。管理员不应该知道用户密码。

You can modify Alfresco Share to store raw password in custom user aspect, but this is very bad practice. Admin shouldn't know user password.

更多推荐

如何从管理员为新用户创建的Alfresco UI页面获取密码?

本文发布于:2023-11-28 17:57:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643395.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新用户   管理员   密码   页面   Alfresco

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!