Magento change password reset email template - email

I'm building an e-commerce website using magento 1.6.1.0. I'm using one extension that will force users to login before entering into website. Everything is going fine the problem is only with forgotpassword reset link. That extension is blocking this reset password link also. I didn't got any support from that extension team.
Today morning i worked in email template to change magento default logo. At that time i got one idea that while creating a new account we'll get a details of email, password. why can't we use that email template instead of reset password link template?
I tried copy pasting all contents from account_new.html to account_password_reset_confirmation.html from app/locale/en_US/template/email
After doing these changes i got a email with emailL:xxx#mydomain.com & Password:
I got the mail as empty password field.
Please guide me to change the template of forgot password from account_password_reset_confirmation.html to account_new.html so that i can send the password directly.

may i have your code to debug if you use
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->getPassword();
it wont work.
password will be encrypted in the database. so you cant make use of it. the only way is generating new password and update it in the database and send the new password to the user mail.
sample code to generate custom password
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; //Random password generation
$pass = array(); //remember to declare $pass as an array
$alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
for ($i = 0; $i < 6; $i++) {
$n = rand(0, $alphaLength);
$pass[] = $alphabet[$n];
}
$newpassword =implode($pass);

Related

Authenticatee FrontendUser via PHP API call from Extbase

First of all im Using TYPO3 Version 8.7.
The current problem i'm facing regards authentication of FrontendUser (fe_user) stored on a given page (in this case pid 168).
Apparently i'm trying to authenticate user with given credentials sent by a mobile application. I'm able to parse the user data and perform an authentication:
// plain-text password
$password = 'XXX';
// salted user password hash
$saltedPassword = 'YYY';
// keeps status if plain-text password matches given salted user password hash
$success = FALSE;
if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
$objSalt = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($saltedPassword);
if (is_object($objSalt)) {
$success = $objSalt->checkPassword($password, $saltedPassword);
}
}
While debugging this code snippet, i recognized the password sent by the user via Request, which gets encrypted with the given Salt algorithm change every time i retry this request. I'm not sure how to get a correct authentication, if the password changes constantly.
The $objSalt object contains the right Hashing Method($pbkdf2-sha256$25000), the password stored in the Database starts with the same prefix, but the actual payload is different.
So What is the exact problem or whats the thing i'm missing in the above code to complete the authentication?
Thanks for your help
BR,
Martin
the password sent by the user via Request, which gets encrypted with the given Salt algorithm change every time i retry this request
Yes, that because the salt is changed every time.
You should retrieve the salting instance with:
$instance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($user['password']);

How to do Password hashing in cakephp 3 manually?

I am working on forgot password and i want to send the new password using rand() . After sending the password to customer email i want to update the new password with hashing but i do not know how to do this ? Please help me to solve this ?
code:
$hash = Security::hash('CakePHP Framework');
error : Class 'App\Controller\Security' not found
Just use the following line in the controller.
use Cake\Auth\DefaultPasswordHasher;
Now you can use the following code to hash your password manually.
$password = "Your Password";
$hasher = new DefaultPasswordHasher();
$hasher->hash($password);

Facebook External doesn't get email value in Nopcommerce 3.60

Currently I use NopCommerce 3.60 and use FB External Login.
Problem:
After I login in Nop by FB External Button and it returns to URL mydomain.com/login#_=__ with red message (Email is required) and it does not login user in.
Screenshot: http://postimg.org/image/wvgu6wvud/
What I was try:
Reinstall Nop from scratch and has below setting
In advance setting and option I has:
Externalauthenticationsettings.requireemailvalidation False
Auto register enabled: Checked.
Registration method: Email Validation
I try to debug source code in file name FacebookProviderAuthorizer.cs in Nop.Plugin.ExternalAuth.Facebook folder and also does not get email value too.http://postimg.org/image/qwmphn9tn/
Have anyone suggest me what to do next for this problem please.
Fixed. You can see changeset 5bb6815e30ee
I am not familiar with Nop, but it is possible to register at Facebook without an email. This is why most libraries for fb-oauth checking against eMail and if there is no email, they create an user-id#facebook.com eMail address.
Maybe your Nop library of fb-oauth is out dated?
So please check if there is such a function - if not, you might got your problem.
Somehow FB doesn't include email in oauth. You can use this method to get email and supply that email to register.
//as part of the uri for the webrequest, include all the fields you want to use
var request = WebRequest.Create("https://graph.facebook.com/me?fields=email,name&access_token=" + Uri.EscapeDataString(authorization.AccessToken));
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
System.IO.StreamReader streamReader = new System.IO.StreamReader(responseStream, true);
string MyStr = streamReader.ReadToEnd();
JObject userInfo = JObject.Parse(MyStr);
//now you can access elements via:
// (string)userInfo["name"], userInfo["email"], userInfo["id"], etc.
}
}

Sending HTML email from Joomla! component

I am developing a Joomla!3.0/3.1 component that allows people to book a golf lesson online. When they complete the booking and process paypal payment, I want to send them a receipt/confirmation email.
I can do this fine and send the information in html or plain text format. However I don't like the fact that I now have view (email content) data within my controller code.
Is it possible to have a sort of template view file which can be parsed and sent as the contents instead? or am I stuck with it in my code?
Thanks,
Chris
On admin side create a section for editing your email template with Joomla's default editor
you an create an editor on the backend and open an html file inside that, for changing the styles ,formats content etc for users.
keep your template file as an HTML file on server and email sending time something like below.
function send_mail_account_pages($email_title,$greeting_text,$subject,$email_content,$user_email){
$config = JFactory::getConfig();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$path = JPATH_BASE."/email_tmpl/";
$fp = fopen($path."email_tmpl.html","r");
$fsize = filesize($path."email_tmpl.html");
$fcontent = fread($fp,$fsize);
fclose($fp);
$date_format = date("M.d, Y");
$fcontent = str_replace("{email_page_title}",$email_title,$fcontent);
$fcontent = str_replace("{date}",$date_format,$fcontent);
$fcontent = str_replace("{greeting_text}",$greeting_text,$fcontent);
$fcontent = str_replace("{email_content}",$email_content,$fcontent);
$fcontent = str_replace("{thanks_text}",THANKS_TEXT,$fcontent);
$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $user_email, $subject, $fcontent,1);
}
This way you can make admin users to give access to change the template styles make sure admin users do not edit the {place holders}.
Hope its helps..
Add a configuration field to your component of type textarea or editor, and let the user write the email template. You should explain which tokens are available or at least provide a default text, such as
Dear {USERNAME},
today I received {NUM_MESSAGES} messages on your behalf,
and your profile has been viewed {NUM_PROFILEVIEWS} times.
Then simply replace the {TOKENS} in your code with str_replace.

smtp emails from cakephp vender returning: code: -1, response: lid mail address 'no-reply')]

I have a cakephp site, built by another developer that sends emails with a vender ('smtpmail'), this has worked fine in the past but just migrated to another server and I am now getting the below error.
can't find anything like this on google, anyone else seen this?
authentication failure [SMTP: Invalid response code received from server (code: -1, response: lid mail address 'no-reply')]
I have set up all the needed configuration
private $host = "mail.example.com";
private $pure_host = "example.com";
private $port = "25";
private $username = "no-reply";
private $password = "****";
(example not the actual name of the site!)
Any suggestions much appreciated
check if the private $username = "no-reply"; is an actual existing email account, maybe your server needs the full username to log in eg: private $username = "no-reply#urdomain.com"; make sure your password is also set.