mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 04:19:12 +00:00
New code, building a migration routine.
This commit is contained in:
@@ -37,4 +37,21 @@ class EmailHelper implements EmailHelperInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function sendResetVerification(\User $user)
|
||||
{
|
||||
$reset = \Str::random(32);
|
||||
$user->reset = $reset;
|
||||
$user->save();
|
||||
$email = $user->email;
|
||||
|
||||
$data = ['reset' => $reset];
|
||||
\Mail::send(
|
||||
['emails.user.remindme-html', 'emails.user.remindme-text'], $data, function ($message) use ($email) {
|
||||
$message->to($email, $email)->subject('Forgot your password?');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,5 +6,6 @@ interface EmailHelperInterface {
|
||||
|
||||
public function sendVerificationMail(\User $user);
|
||||
public function sendPasswordMail(\User $user);
|
||||
public function sendResetVerification(\User $user);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Firefly\Storage\Account;
|
||||
|
||||
|
||||
interface AccountRepositoryInterface
|
||||
{
|
||||
public function count();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Firefly\Storage\Account;
|
||||
|
||||
class EloquentAccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function count() {
|
||||
return \Auth::user()->accounts()->count();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,11 @@ class StorageServiceProvider extends ServiceProvider
|
||||
'Firefly\Storage\User\UserRepositoryInterface',
|
||||
'Firefly\Storage\User\EloquentUserRepository'
|
||||
);
|
||||
|
||||
$this->app->bind(
|
||||
'Firefly\Storage\Account\AccountRepositoryInterface',
|
||||
'Firefly\Storage\Account\EloquentAccountRepository'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,4 +41,13 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
return \User::where('verification', $verification)->first();
|
||||
}
|
||||
|
||||
public function findByReset($reset)
|
||||
{
|
||||
return \User::where('reset', $reset)->first();
|
||||
}
|
||||
public function findByEmail($email)
|
||||
{
|
||||
return \User::where('email', $email)->first();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,9 +7,13 @@ namespace Firefly\Storage\User;
|
||||
interface UserRepositoryInterface
|
||||
{
|
||||
public function register();
|
||||
|
||||
public function auth();
|
||||
|
||||
public function findByVerification($verification);
|
||||
public function findByReset($reset);
|
||||
|
||||
public function findByEmail($email);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user