mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
Combination of initial files and some new code for login and user registration.
This commit is contained in:
44
app/lib/Firefly/Storage/User/EloquentUserRepository.php
Normal file
44
app/lib/Firefly/Storage/User/EloquentUserRepository.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Firefly\Storage\User;
|
||||
|
||||
class EloquentUserRepository implements UserRepositoryInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$user = new \User;
|
||||
$user->email = \Input::get('email');
|
||||
$user->migrated = 0;
|
||||
$user->verification = \Str::random(32);
|
||||
$user->password = \Hash::make(\Str::random(12));
|
||||
|
||||
if (!$user->isValid()) {
|
||||
\Log::error('Invalid user');
|
||||
\Session::flash('error', 'Input invalid, please try again.');
|
||||
return false;
|
||||
}
|
||||
$user->save();
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function auth()
|
||||
{
|
||||
$user = \User::where('email', \Input::get('email'))->first();
|
||||
if (!is_null($user)) {
|
||||
if (\Hash::check(\Input::get('password'), $user->password)) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function findByVerification($verification)
|
||||
{
|
||||
return \User::where('verification', $verification)->first();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user