如何从管理员为新用户创建的Alfresco UI页面获取密码? [英] How to fetch password from Alfresco UI page which has been created by admin for the new user?

查看:242
本文介绍了如何从管理员为新用户创建的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页面获取密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆