Page 1 of 1

Show user password in email template

Posted: Tue Sep 09, 2008 2:54 am
by Odettes
Hi!

I would like to create a email template to be used to send out to my custumers password when they have forget it.
I dont want to use the reset email template!
My problem is I cant get the nvelocity zyntax to work in the emailtemplate.
I have tried like this to write out the password without success:

${User.Password}!
$User.Password!
${Order.Password}!
$Order.Password!

Anyone who can help me to get the right zyntax?

Best regards, Thomas

Re: Show user password in email template

Posted: Tue Sep 09, 2008 12:49 pm
by Odettes
OK, I found the answear, its not possible...
viewtopic.php?f=42&t=7404&p=30958&hilit ... ord#p30958

Since I autogenerate password for my customers it gives me problem, I guess I have to store the password uncrypted in a custom fiels somewhere to be able to send it out.

Re: Show user password in email template

Posted: Wed Sep 10, 2008 2:28 am
by mazhar
Yes you can place it in some file or may create some db table

Re: Show user password in email template

Posted: Thu Sep 11, 2008 10:00 am
by nickc
Able has a place to store user specific details: UserSettings
Here's a little snippet for adding a name/value pair like that:

Code: Select all

                string query = String.Format("UserId = {0} and FieldName = '{1}' and FieldValue = '{2}'", user.UserId, "PlainTextPassword", strPlainTextPassword);
                if (UserSettingDataSource.CountForCriteria(query) == 0)
                {
                    UserSetting us = new UserSetting();
                    us.UserId = user.UserId;
                    us.FieldName = "PlainTextPassword";
                    us.FieldValue = strPlainTextPassword;
                    us.Save();
                }
then you can access with:

Code: Select all

            UserSettingCollection usersettings = new UserSettingCollection();
            usersettings = UserSettingDataSource.LoadForUser(user.UserId);
            foreach (UserSetting setting in usersettings)
            {
                if ((setting.FieldName == "PlainTextPassword")

                ...

Re: Show user password in email template

Posted: Fri Sep 12, 2008 1:32 am
by mazhar
Yes User Settings is very good location to store user related information, you can use it as well.

Re: Show user password in email template

Posted: Fri Sep 12, 2008 7:34 am
by jmestep
Not exactly related to this,but would the user settings be a better place to store a customer's access to certain products rather than putting them into a particular group? For example, only certain users can view certain products.

Re: Show user password in email template

Posted: Fri Sep 12, 2008 9:50 pm
by mazhar
Yes it could be used