-->

Auto Generate user passwords and directly sending

2019-03-01 03:26发布

问题:

This question is an exact duplicate of:

  • Auto-generation of email with username and random password on creation of new user 1 answer

My task is to do the following in Alfresco:

When a user is created, the password is auto-generated and the login credentials being sent to the users email address directly, instead of the admin having to enter the password and sending it manually to the newly created users.

Please guide me how to start and proceed in this...

回答1:

You can refer to my answer for Creating user in alfresco

You can write some random algorithm to generate password. Also you can write some EmailService which can send the credential mail to the user.



回答2:

i know that this answer look's like Sachin Mesare's answer but it's a little bit différente, i will cut my answer to give something in every part of your question

Part 1 : Create User

1 - you have a start of an answer in this post answered by our friend Sachin Mesare Create Alfresco User

2 - you can see this solution maided by Alfresco Community Add a person JAVA API personally i used this method to create and add a person that worked fine for me (do not forget to read all the post : there's an improvement in the bottom)

Part 2 : Send an Email

1 - you can use this wonderful tutorial that give you the path to follow to send an EMail with Java Api Mail Java - Sending Email

2 - you can find so many StackOverFlow questions ( with answers ) that i selected this one Send email using java

Part 3 : Password

you have 2 ways to do something like that

Solution 1 : encrypte/decrypt it (it's a two ways working method) that mean that if you use an algorithme to encrypte it someone can use the same to decrypt your password.

Solution 2 : Hash it that's a one way method that mean if you hash your password no one even you can get the original password, the most well known method to Hash password is sha256

Hope that helped you



标签: java alfresco