mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 18:58:07 +00:00
New code, building a migration routine.
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
class HomeController extends BaseController {
|
||||
|
||||
public function __construct(ARI $accounts) {
|
||||
$this->accounts = $accounts;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$count = $this->accounts->count();
|
||||
if($count == 0) {
|
||||
return Redirect::route('start');
|
||||
}
|
||||
return View::make('index');
|
||||
}
|
||||
|
||||
public function start() {
|
||||
return View::make('start');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
29
app/controllers/MigrationController.php
Normal file
29
app/controllers/MigrationController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
class MigrationController extends BaseController {
|
||||
public function index() {
|
||||
// check if database connection is present.
|
||||
$configValue = Config::get('database.connections.old-firefly');
|
||||
if(is_null($configValue)) {
|
||||
return View::make('migrate.index');
|
||||
}
|
||||
|
||||
// try to connect to it:
|
||||
try {
|
||||
DB::connection('old-firefly')->select('SELECT * from `users`;');
|
||||
} catch(PDOException $e) {
|
||||
return View::make('migrate.index');
|
||||
}
|
||||
|
||||
return Redirect::route('migrate.select-user');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function selectUser() {
|
||||
// select a user to import data from.
|
||||
}
|
||||
|
||||
public function migrate($userID) {
|
||||
// import the data.
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,10 @@ class UserController extends BaseController
|
||||
{
|
||||
if (!$this->user->auth()) {
|
||||
$rememberMe = Input::get('remember_me') == '1';
|
||||
$result = [];
|
||||
$data = [
|
||||
'email' => Input::get('email'),
|
||||
'email' => Input::get('email'),
|
||||
'password' => Input::get('password')
|
||||
];
|
||||
|
||||
|
||||
if (Auth::attempt($data, $rememberMe)) {
|
||||
return Redirect::route('index');
|
||||
}
|
||||
@@ -62,6 +59,33 @@ class UserController extends BaseController
|
||||
return View::make('user.register');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
Auth::logout();
|
||||
return Redirect::route('index');
|
||||
}
|
||||
|
||||
public function remindme()
|
||||
{
|
||||
return View::make('user.remindme');
|
||||
}
|
||||
|
||||
public function postRemindme()
|
||||
{
|
||||
$user = $this->user->findByEmail(Input::get('email'));
|
||||
if ($user) {
|
||||
if (Config::get('auth.verify_reset') === true) {
|
||||
$this->email->sendResetVerification($user);
|
||||
}
|
||||
if (Config::get('auth.verify_reset') === false) {
|
||||
$this->email->sendPasswordMail($user);
|
||||
}
|
||||
}
|
||||
Session::flash('error', 'No good!');
|
||||
return View::make('user.remindme');
|
||||
|
||||
}
|
||||
|
||||
public function verify($verification)
|
||||
{
|
||||
$user = $this->user->findByVerification($verification);
|
||||
@@ -71,5 +95,14 @@ class UserController extends BaseController
|
||||
}
|
||||
return View::make('error')->with('message', 'Yo no hablo verification code!');
|
||||
}
|
||||
public function reset($reset)
|
||||
{
|
||||
$user = $this->user->findByReset($reset);
|
||||
if ($user) {
|
||||
$this->email->sendPasswordMail($user);
|
||||
return View::make('user.registered');
|
||||
}
|
||||
return View::make('error')->with('message', 'Yo no hablo reset code!');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user