mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Combination of initial files and some new code for login and user registration.
This commit is contained in:
40
app/lib/Firefly/Helper/Email/EmailHelper.php
Normal file
40
app/lib/Firefly/Helper/Email/EmailHelper.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace Firefly\Helper\Email;
|
||||
|
||||
class EmailHelper implements EmailHelperInterface
|
||||
{
|
||||
public function sendVerificationMail(\User $user)
|
||||
{
|
||||
|
||||
$verification = \Str::random(32);
|
||||
$user->verification = $verification;
|
||||
$user->save();
|
||||
$email = $user->email;
|
||||
$data = ['verification' => $verification];
|
||||
|
||||
\Mail::send(
|
||||
['emails.user.verify-html', 'emails.user.verify-text'], $data, function ($message) use ($email) {
|
||||
$message->to($email, $email)->subject('Verify your e-mail address.');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function sendPasswordMail(\User $user)
|
||||
{
|
||||
|
||||
$password = \Str::random(12);
|
||||
$user->password = \Hash::make($password);
|
||||
$user->verification = \Str::random(32); // new one.
|
||||
$user->save();
|
||||
$email = $user->email;
|
||||
|
||||
|
||||
$data = ['password' => $password];
|
||||
\Mail::send(
|
||||
['emails.user.register-html', 'emails.user.register-text'], $data, function ($message) use ($email) {
|
||||
$message->to($email, $email)->subject('Welcome to Firefly!');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
10
app/lib/Firefly/Helper/Email/EmailHelperInterface.php
Normal file
10
app/lib/Firefly/Helper/Email/EmailHelperInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Firefly\Helper\Email;
|
||||
|
||||
interface EmailHelperInterface {
|
||||
|
||||
public function sendVerificationMail(\User $user);
|
||||
public function sendPasswordMail(\User $user);
|
||||
|
||||
}
|
Reference in New Issue
Block a user