I need help. I'm using Laravel 4, I'm very new in laravel and i have 4 days in a row trying to solve this problem :(
I don't know how to decrypt a password to email it to the user and with it, activate his account.
I hope you can help me. Thanks.
My RegController.php:
//creates a key for 24h to activate account
$key = Str::random(32);
Cookie::queue('key', $key, 60*24);
Cookie::queue('email', $user->email, 60*24);
//creates url
$msg = "<a href='".URL::to("registration/$user->email/$key")."'>Confirm acount</a>";
$data = array(
'user' => $user,
'msg' => $msg,
);
$fromEmail = 'noreply@noreply.com';
$fromName = 'Administrator';
Mail::send('emails.register', $data, function($message) use ($fromName, $fromEmail, $user){
$message->to($user->email);
$message->from($fromEmail, $fromName);
$message->subject('Confirm registration in Laravel');
});
$message = '<hr><label class="label label-info">we sent an email to confirm your registration</label><hr>';
return Redirect::to('registro')->with('message', $message);
The view show in the email:
<html>
<head></head>
<body>
<h1>Welcome to the aplication Laravel</h1>
<h1>Your user: {{$user->username}}</h1>
<h1>Your password: {{$passworddecrypted)}}</h1>
<p>Confirm your registration on this link:</p>
{{$msg}}
</body>
</html>
I don't know how to decrypt in this part, when I send the email, the encrypted password always appears
Email example:
Welcome to the aplication Laravel
Your user: lalo
Your password: eyJpdiI6IllHZzFcL1hxaGNRd2w0UkRLZTdNMWt3PT0iLCJ2YWx1ZSI6IlJZMmkyeElYRVpka21cL25BU2ZrQ093PT0iLCJtYWMiOiI5ZTBlYTYzOTZjOTE0YmFkZDE4OTlkY2M1MjBiMGRmOGZkMWExYTE0MzI1MWNiN2FmMGM0ZjllMjcxZjVjZjYyIn0=
Confirm your registration on this link:
Confirm registration in Laravel.