New code, building a migration routine.

This commit is contained in:
James Cole
2014-06-30 07:26:38 +02:00
parent 5d430e7dad
commit ecadf005a8
23 changed files with 338 additions and 15 deletions

View File

@@ -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');
}
}

View 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.
}
}

View File

@@ -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!');
}
}