diff --git a/app/config/app.php b/app/config/app.php index f58e14fcd3..d0b412010f 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -1,99 +1,14 @@ false, - - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ - 'url' => 'http://localhost', - - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - 'timezone' => 'UTC', - - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ - 'locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ - 'fallback_locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ - 'key' => 'D93oqmVsIARg23FC3cbsHuBGk0uXQc3r', - 'cipher' => MCRYPT_RIJNDAEL_128, - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => array( + 'providers' => [ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', @@ -123,35 +38,11 @@ return array( 'Illuminate\Workbench\WorkbenchServiceProvider', 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', 'Barryvdh\Debugbar\ServiceProvider', - - - ), - - /* - |-------------------------------------------------------------------------- - | Service Provider Manifest - |-------------------------------------------------------------------------- - | - | The service provider manifest is used by Laravel to lazy load service - | providers which are not needed for each request, as well to keep a - | list of all of the services. Here, you may set its storage spot. - | - */ - + 'Firefly\Storage\StorageServiceProvider', + 'Firefly\Helper\HelperServiceProvider', + ], 'manifest' => storage_path() . '/meta', - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ - - 'aliases' => array( + 'aliases' => [ 'App' => 'Illuminate\Support\Facades\App', 'Artisan' => 'Illuminate\Support\Facades\Artisan', @@ -192,6 +83,6 @@ return array( 'Validator' => 'Illuminate\Support\Facades\Validator', 'View' => 'Illuminate\Support\Facades\View', - ), + ], -); +]; diff --git a/app/config/auth.php b/app/config/auth.php index eacbbfaedd..6e606f0ebe 100644 --- a/app/config/auth.php +++ b/app/config/auth.php @@ -1,71 +1,16 @@ 'eloquent', + 'model' => 'User', + 'table' => 'users', + 'reminder' => [ + 'email' => 'emails.auth.reminder', + 'table' => 'password_reminders', + 'expire' => 60, + ], + 'verify_mail' => true, + 'verify_reset' => true, + 'allow_register' => true - /* - |-------------------------------------------------------------------------- - | Default Authentication Driver - |-------------------------------------------------------------------------- - | - | This option controls the authentication driver that will be utilized. - | This driver manages the retrieval and authentication of the users - | attempting to get access to protected areas of your application. - | - | Supported: "database", "eloquent" - | - */ - - 'driver' => 'eloquent', - - /* - |-------------------------------------------------------------------------- - | Authentication Model - |-------------------------------------------------------------------------- - | - | When using the "Eloquent" authentication driver, we need to know which - | Eloquent model should be used to retrieve your users. Of course, it - | is often just the "User" model but you may use whatever you like. - | - */ - - 'model' => 'User', - - /* - |-------------------------------------------------------------------------- - | Authentication Table - |-------------------------------------------------------------------------- - | - | When using the "Database" authentication driver, we need to know which - | table should be used to retrieve your users. We have chosen a basic - | default value but you may easily change it to any table you like. - | - */ - - 'table' => 'users', - - /* - |-------------------------------------------------------------------------- - | Password Reminder Settings - |-------------------------------------------------------------------------- - | - | Here you may set the settings for password reminders, including a view - | that should be used as your password reminder e-mail. You will also - | be able to set the name of the table that holds the reset tokens. - | - | The "expire" time is the number of minutes that the reminder should be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - */ - - 'reminder' => array( - - 'email' => 'emails.auth.reminder', - - 'table' => 'password_reminders', - - 'expire' => 60, - - ), - -); +]; diff --git a/app/config/cache.php b/app/config/cache.php index ce89842399..8fa089055b 100644 --- a/app/config/cache.php +++ b/app/config/cache.php @@ -1,89 +1,12 @@ 'file', - - /* - |-------------------------------------------------------------------------- - | File Cache Location - |-------------------------------------------------------------------------- - | - | When using the "file" cache driver, we need a location where the cache - | files may be stored. A sensible default has been specified, but you - | are free to change it to any other place on disk that you desire. - | - */ - - 'path' => storage_path().'/cache', - - /* - |-------------------------------------------------------------------------- - | Database Cache Connection - |-------------------------------------------------------------------------- - | - | When using the "database" cache driver you may specify the connection - | that should be used to store the cached items. When this option is - | null the default database connection will be utilized for cache. - | - */ - - 'connection' => null, - - /* - |-------------------------------------------------------------------------- - | Database Cache Table - |-------------------------------------------------------------------------- - | - | When using the "database" cache driver we need to know the table that - | should be used to store the cached items. A default table name has - | been provided but you're free to change it however you deem fit. - | - */ - - 'table' => 'cache', - - /* - |-------------------------------------------------------------------------- - | Memcached Servers - |-------------------------------------------------------------------------- - | - | Now you may specify an array of your Memcached servers that should be - | used when utilizing the Memcached cache driver. All of the servers - | should contain a value for "host", "port", and "weight" options. - | - */ - - 'memcached' => array( - - array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), - - ), - - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. - | - */ - - 'prefix' => 'laravel', - -); +return [ + 'driver' => 'file', + 'path' => storage_path() . '/cache', + 'connection' => null, + 'table' => 'cache', + 'memcached' => [ + ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100], + ], + 'prefix' => 'laravel', +]; diff --git a/app/config/compile.php b/app/config/compile.php index d5e55181b3..b993871588 100644 --- a/app/config/compile.php +++ b/app/config/compile.php @@ -1,18 +1,3 @@ PDO::FETCH_CLASS, + 'default' => 'mysql', + 'connections' => [ - /* - |-------------------------------------------------------------------------- - | PDO Fetch Style - |-------------------------------------------------------------------------- - | - | By default, database results will be returned as instances of the PHP - | stdClass object; however, you may desire to retrieve records in an - | array format for simplicity. Here you can tweak the fetch style. - | - */ + 'sqlite' => [ + 'driver' => 'sqlite', + 'database' => __DIR__ . '/../database/production.sqlite', + 'prefix' => '', + ], - 'fetch' => PDO::FETCH_CLASS, + 'mysql' => [ + 'driver' => 'mysql', + 'host' => 'localhost', + 'database' => 'forge', + 'username' => 'forge', + 'password' => '', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + ], + ], + 'migrations' => 'migrations', + 'redis' => [ - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ + 'cluster' => false, - 'default' => 'mysql', + 'default' => [ + 'host' => '127.0.0.1', + 'port' => 6379, + 'database' => 0, + ], - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ + ], - 'connections' => array( - - 'sqlite' => array( - 'driver' => 'sqlite', - 'database' => __DIR__.'/../database/production.sqlite', - 'prefix' => '', - ), - - 'mysql' => array( - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - ), - - 'pgsql' => array( - 'driver' => 'pgsql', - 'host' => 'localhost', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - ), - - 'sqlsrv' => array( - 'driver' => 'sqlsrv', - 'host' => 'localhost', - 'database' => 'database', - 'username' => 'root', - 'password' => '', - 'prefix' => '', - ), - - ), - - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - - 'migrations' => 'migrations', - - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ - - 'redis' => array( - - 'cluster' => false, - - 'default' => array( - 'host' => '127.0.0.1', - 'port' => 6379, - 'database' => 0, - ), - - ), - -); +]; diff --git a/app/config/mail.php b/app/config/mail.php index 76fd9e4f80..19322bc036 100644 --- a/app/config/mail.php +++ b/app/config/mail.php @@ -1,124 +1,13 @@ 'smtp', - - /* - |-------------------------------------------------------------------------- - | SMTP Host Address - |-------------------------------------------------------------------------- - | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. - | - */ - - 'host' => 'smtp.mailgun.org', - - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- - | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. - | - */ - - 'port' => 587, - - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ - - 'from' => array('address' => null, 'name' => null), - - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ - - 'encryption' => 'tls', - - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ - - 'username' => null, - - /* - |-------------------------------------------------------------------------- - | SMTP Server Password - |-------------------------------------------------------------------------- - | - | Here you may set the password required by your SMTP server to send out - | messages from your application. This will be given to the server on - | connection so that the application will be able to send messages. - | - */ - - 'password' => null, - - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ - - 'sendmail' => '/usr/sbin/sendmail -bs', - - /* - |-------------------------------------------------------------------------- - | Mail "Pretend" - |-------------------------------------------------------------------------- - | - | When this option is enabled, e-mail will not actually be sent over the - | web and will instead be written to your application's logs files so - | you may inspect the message. This is great for local development. - | - */ - - 'pretend' => false, - -); +return [ + 'driver' => 'smtp', + 'host' => 'smtp.gmail.com', + 'port' => 587, + 'from' => ['address' => 'nder.firefly@gmail.com', 'name' => 'Firefly V'], + 'encryption' => 'tls', + 'username' => 'nder.firefly@gmail.com', + 'password' => 'bzQj252LqefJnorN28dLzph7oNclXNEV986mjX', + 'sendmail' => '/usr/sbin/sendmail -bs', + 'pretend' => false, +]; diff --git a/app/config/queue.php b/app/config/queue.php index 940a4cdfec..79da1ff9c7 100755 --- a/app/config/queue.php +++ b/app/config/queue.php @@ -1,85 +1,45 @@ 'sync', + 'connections' => [ - /* - |-------------------------------------------------------------------------- - | Default Queue Driver - |-------------------------------------------------------------------------- - | - | The Laravel queue API supports a variety of back-ends via an unified - | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "sync", "beanstalkd", "sqs", "iron", "redis" - | - */ + 'sync' => [ + 'driver' => 'sync', + ], - 'default' => 'sync', + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'ttr' => 60, + ], - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - */ + 'sqs' => [ + 'driver' => 'sqs', + 'key' => 'your-public-key', + 'secret' => 'your-secret-key', + 'queue' => 'your-queue-url', + 'region' => 'us-east-1', + ], - 'connections' => array( + 'iron' => [ + 'driver' => 'iron', + 'host' => 'mq-aws-us-east-1.iron.io', + 'token' => 'your-token', + 'project' => 'your-project-id', + 'queue' => 'your-queue-name', + 'encrypt' => true, + ], - 'sync' => array( - 'driver' => 'sync', - ), + 'redis' => [ + 'driver' => 'redis', + 'queue' => 'default', + ], - 'beanstalkd' => array( - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'ttr' => 60, - ), + ], + 'failed' => [ + 'database' => 'mysql', 'table' => 'failed_jobs', + ], - 'sqs' => array( - 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'queue' => 'your-queue-url', - 'region' => 'us-east-1', - ), - - 'iron' => array( - 'driver' => 'iron', - 'host' => 'mq-aws-us-east-1.iron.io', - 'token' => 'your-token', - 'project' => 'your-project-id', - 'queue' => 'your-queue-name', - 'encrypt' => true, - ), - - 'redis' => array( - 'driver' => 'redis', - 'queue' => 'default', - ), - - ), - - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ - - 'failed' => array( - - 'database' => 'mysql', 'table' => 'failed_jobs', - - ), - -); +]; diff --git a/app/config/remote.php b/app/config/remote.php index 2169c434b4..3104bf7e34 100644 --- a/app/config/remote.php +++ b/app/config/remote.php @@ -1,59 +1,21 @@ 'production', + 'connections' => [ - /* - |-------------------------------------------------------------------------- - | Default Remote Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify the default connection that will be used for SSH - | operations. This name should correspond to a connection name below - | in the server list. Each connection will be manually accessible. - | - */ + 'production' => [ + 'host' => '', + 'username' => '', + 'password' => '', + 'key' => '', + 'keyphrase' => '', + 'root' => '/var/www', + ], + ], + 'groups' => [ + 'web' => ['production'] - 'default' => 'production', + ], - /* - |-------------------------------------------------------------------------- - | Remote Server Connections - |-------------------------------------------------------------------------- - | - | These are the servers that will be accessible via the SSH task runner - | facilities of Laravel. This feature radically simplifies executing - | tasks on your servers, such as deploying out these applications. - | - */ - - 'connections' => array( - - 'production' => array( - 'host' => '', - 'username' => '', - 'password' => '', - 'key' => '', - 'keyphrase' => '', - 'root' => '/var/www', - ), - - ), - - /* - |-------------------------------------------------------------------------- - | Remote Server Groups - |-------------------------------------------------------------------------- - | - | Here you may list connections under a single group name, which allows - | you to easily access all of the servers at once using a short name - | that is extremely easy to remember, such as "web" or "database". - | - */ - - 'groups' => array( - - 'web' => array('production') - - ), - -); +]; diff --git a/app/config/services.php b/app/config/services.php index c8aba2a6da..c252b2be65 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -1,31 +1,19 @@ [ + 'domain' => '', + 'secret' => '', + ], - 'mailgun' => array( - 'domain' => '', - 'secret' => '', - ), + 'mandrill' => [ + 'secret' => '', + ], - 'mandrill' => array( - 'secret' => '', - ), + 'stripe' => [ + 'model' => 'User', + 'secret' => '', + ], - 'stripe' => array( - 'model' => 'User', - 'secret' => '', - ), - -); +]; diff --git a/app/config/session.php b/app/config/session.php index ae343029ee..6e07b5115b 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -1,140 +1,16 @@ 'file', + 'lifetime' => 120, + 'expire_on_close' => false, + 'files' => storage_path() . '/sessions', + 'connection' => null, + 'table' => 'sessions', + 'lottery' => array(2, 100), + 'cookie' => 'laravel_session', + 'path' => '/', + 'domain' => null, + 'secure' => false, - /* - |-------------------------------------------------------------------------- - | Default Session Driver - |-------------------------------------------------------------------------- - | - | This option controls the default session "driver" that will be used on - | requests. By default, we will use the lightweight native driver but - | you may specify any of the other wonderful drivers provided here. - | - | Supported: "file", "cookie", "database", "apc", - | "memcached", "redis", "array" - | - */ - - 'driver' => 'file', - - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ - - 'lifetime' => 120, - - 'expire_on_close' => false, - - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ - - 'files' => storage_path().'/sessions', - - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ - - 'connection' => null, - - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ - - 'table' => 'sessions', - - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ - - 'lottery' => array(2, 100), - - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ - - 'cookie' => 'laravel_session', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ - - 'path' => '/', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ - - 'domain' => null, - - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. - | - */ - - 'secure' => false, - -); +]; diff --git a/app/config/view.php b/app/config/view.php index 34b8f38735..e0529fb669 100644 --- a/app/config/view.php +++ b/app/config/view.php @@ -1,31 +1,6 @@ array(__DIR__.'/../views'), - - /* - |-------------------------------------------------------------------------- - | Pagination View - |-------------------------------------------------------------------------- - | - | This view will be used to render the pagination link output, and can - | be easily customized here to show any view you like. A clean view - | compatible with Twitter's Bootstrap is given to you by default. - | - */ - - 'pagination' => 'pagination::slider-3', - -); +return [ + 'paths' => array(__DIR__ . '/../views'), + 'pagination' => 'pagination::slider-3', +]; diff --git a/app/config/workbench.php b/app/config/workbench.php index 87c5e3879e..62c843d71d 100644 --- a/app/config/workbench.php +++ b/app/config/workbench.php @@ -1,31 +1,6 @@ '', - - /* - |-------------------------------------------------------------------------- - | Workbench Author E-Mail Address - |-------------------------------------------------------------------------- - | - | Like the option above, your e-mail address is used when generating new - | workbench packages. The e-mail is placed in your composer.json file - | automatically after the package is created by the workbench tool. - | - */ - - 'email' => '', - -); +return [ + 'name' => '', + 'email' => '', +]; diff --git a/app/controllers/RemindersController.php b/app/controllers/RemindersController.php new file mode 100644 index 0000000000..ac59e48c26 --- /dev/null +++ b/app/controllers/RemindersController.php @@ -0,0 +1,75 @@ +with('error', Lang::get($response)); + + case Password::REMINDER_SENT: + return Redirect::back()->with('status', Lang::get($response)); + } + } + + /** + * Display the password reset view for the given token. + * + * @param string $token + * @return Response + */ + public function getReset($token = null) + { + if (is_null($token)) App::abort(404); + + return View::make('password.reset')->with('token', $token); + } + + /** + * Handle a POST request to reset a user's password. + * + * @return Response + */ + public function postReset() + { + $credentials = Input::only( + 'email', 'password', 'password_confirmation', 'token' + ); + + $response = Password::reset($credentials, function($user, $password) + { + $user->password = Hash::make($password); + + $user->save(); + }); + + switch ($response) + { + case Password::INVALID_PASSWORD: + case Password::INVALID_TOKEN: + case Password::INVALID_USER: + return Redirect::back()->with('error', Lang::get($response)); + + case Password::PASSWORD_RESET: + return Redirect::to('/'); + } + } + +} diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php new file mode 100644 index 0000000000..46e01edefc --- /dev/null +++ b/app/controllers/UserController.php @@ -0,0 +1,75 @@ +user = $user; + $this->email = $email; + + } + + public function login() + { + return View::make('user.login'); + } + + public function postLogin() + { + if (!$this->user->auth()) { + $rememberMe = Input::get('remember_me') == '1'; + $result = []; + $data = [ + 'email' => Input::get('email'), + 'password' => Input::get('password') + ]; + + + if (Auth::attempt($data, $rememberMe)) { + return Redirect::route('index'); + } + } + Session::flash('error', 'No good!'); + return View::make('user.login'); + } + + public function register() + { + if (Config::get('auth.allow_register') !== true) { + return App::abort(404); + } + return View::make('user.register'); + } + + public function postRegister() + { + if (Config::get('auth.allow_register') !== true) { + return App::abort(404); + } + $user = $this->user->register(); + if ($user) { + if (Config::get('auth.verify_mail') === true) { + $this->email->sendVerificationMail($user); + return View::make('user.verification-pending'); + } + $this->email->sendPasswordMail($user); + return View::make('user.registered'); + } + return View::make('user.register'); + } + + public function verify($verification) + { + $user = $this->user->findByVerification($verification); + if ($user) { + $this->email->sendPasswordMail($user); + return View::make('user.registered'); + } + return View::make('error')->with('message', 'Yo no hablo verification code!'); + } + +} \ No newline at end of file diff --git a/app/database/migrations/2014_06_27_163032_create_users_table.php b/app/database/migrations/2014_06_27_163032_create_users_table.php new file mode 100644 index 0000000000..380223be20 --- /dev/null +++ b/app/database/migrations/2014_06_27_163032_create_users_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->timestamps(); + $table->string('email',100); + $table->string('password',60); + $table->string('verification',32); + $table->string('remember_token',255)->nullable(); + $table->boolean('migrated'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('users'); + } + +} diff --git a/app/database/migrations/2014_06_27_163145_create_account_types_table.php b/app/database/migrations/2014_06_27_163145_create_account_types_table.php new file mode 100644 index 0000000000..da12408702 --- /dev/null +++ b/app/database/migrations/2014_06_27_163145_create_account_types_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->timestamps(); + $table->string('description', 50); + } + ); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('account_types'); + } + +} diff --git a/app/database/migrations/2014_06_27_163259_create_accounts_table.php b/app/database/migrations/2014_06_27_163259_create_accounts_table.php new file mode 100644 index 0000000000..52f935bd3f --- /dev/null +++ b/app/database/migrations/2014_06_27_163259_create_accounts_table.php @@ -0,0 +1,46 @@ +increments('id'); + $table->timestamps(); + $table->integer('user_id')->unsigned(); + $table->integer('account_type_id')->unsigned(); + $table->string('name',100); + $table->boolean('active'); + + // connect accounts to users + $table->foreign('user_id') + ->references('id')->on('users') + ->onDelete('cascade'); + + // connect accounts to account_types + $table->foreign('account_type_id') + ->references('id')->on('account_types') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('accounts'); + } + +} diff --git a/app/database/migrations/2014_06_27_163734_create_component_types_table.php b/app/database/migrations/2014_06_27_163734_create_component_types_table.php new file mode 100644 index 0000000000..d7b66ca46b --- /dev/null +++ b/app/database/migrations/2014_06_27_163734_create_component_types_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->timestamps(); + $table->string('type',50); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('component_types'); + } + +} diff --git a/app/database/migrations/2014_06_27_163817_create_components_table.php b/app/database/migrations/2014_06_27_163817_create_components_table.php new file mode 100644 index 0000000000..c22acbb31d --- /dev/null +++ b/app/database/migrations/2014_06_27_163817_create_components_table.php @@ -0,0 +1,45 @@ +increments('id'); + $table->timestamps(); + $table->string('name',50); + $table->integer('user_id')->unsigned(); + $table->integer('component_type_id')->unsigned(); + + // connect components to users + $table->foreign('user_id') + ->references('id')->on('users') + ->onDelete('cascade'); + + // connect components to component types + $table->foreign('component_type_id') + ->references('id')->on('component_types') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('components'); + } + +} diff --git a/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php b/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php new file mode 100644 index 0000000000..eb3fef17c6 --- /dev/null +++ b/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->timestamps(); + $table->string('code',3); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_currencies'); + } + +} diff --git a/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php b/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php new file mode 100644 index 0000000000..af12f27009 --- /dev/null +++ b/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->timestamps(); + $table->string('type',50); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_types'); + } + +} diff --git a/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php b/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php new file mode 100644 index 0000000000..a66e01eb09 --- /dev/null +++ b/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php @@ -0,0 +1,46 @@ +increments('id'); + $table->timestamps(); + $table->integer('transaction_type_id')->unsigned(); + $table->integer('transaction_currency_id')->unsigned(); + $table->string('description',255)->nullable(); + $table->date('date'); + + // connect transaction journals to transaction types + $table->foreign('transaction_type_id') + ->references('id')->on('transaction_types') + ->onDelete('cascade'); + + // connect transaction journals to transaction currencies + $table->foreign('transaction_currency_id') + ->references('id')->on('transaction_currencies') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_journals'); + } + +} diff --git a/app/database/migrations/2014_06_27_164836_create_transactions_table.php b/app/database/migrations/2014_06_27_164836_create_transactions_table.php new file mode 100644 index 0000000000..2059e93bae --- /dev/null +++ b/app/database/migrations/2014_06_27_164836_create_transactions_table.php @@ -0,0 +1,42 @@ +increments('id'); + $table->timestamps(); + $table->integer('account_id')->integer(); + $table->integer('transaction_journal_id')->integer()->unsigned(); + $table->string('description',255)->nullable(); + $table->decimal('amount',10,2); + + // connect transactions to transaction journals + $table->foreign('transaction_journal_id') + ->references('id')->on('transaction_journals') + ->onDelete('cascade'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transactions'); + } + +} diff --git a/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php b/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php new file mode 100644 index 0000000000..6011201f51 --- /dev/null +++ b/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->timestamps(); + $table->integer('component_id')->unsigned(); + $table->integer('transaction_id')->unsigned(); + + // connect to components + $table->foreign('component_id') + ->references('id')->on('components') + ->onDelete('cascade'); + + // connect to transactions + $table->foreign('transaction_id') + ->references('id')->on('transactions') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('component_transaction'); + } + +} diff --git a/app/database/migrations/2014_06_29_083517_create_password_reminders_table.php b/app/database/migrations/2014_06_29_083517_create_password_reminders_table.php new file mode 100644 index 0000000000..dfbcf83fef --- /dev/null +++ b/app/database/migrations/2014_06_29_083517_create_password_reminders_table.php @@ -0,0 +1,33 @@ +string('email')->index(); + $table->string('token')->index(); + $table->timestamp('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('password_reminders'); + } + +} diff --git a/app/database/seeds/AccountTypeSeeder.php b/app/database/seeds/AccountTypeSeeder.php new file mode 100644 index 0000000000..f0f95532ce --- /dev/null +++ b/app/database/seeds/AccountTypeSeeder.php @@ -0,0 +1,25 @@ +delete(); + + AccountType::create( + ['description' => 'Default account'] + ); + AccountType::create( + ['description' => 'Cash account'] + ); + AccountType::create( + ['description' => 'Initial balance account'] + ); + AccountType::create( + ['description' => 'Beneficiary account'] + ); + } + + +} \ No newline at end of file diff --git a/app/database/seeds/ComponentTypeSeeder.php b/app/database/seeds/ComponentTypeSeeder.php new file mode 100644 index 0000000000..58dd2f7139 --- /dev/null +++ b/app/database/seeds/ComponentTypeSeeder.php @@ -0,0 +1,16 @@ +delete(); + + ComponentType::create(['type' => 'category']); + ComponentType::create(['type' => 'budget']); + } + +} \ No newline at end of file diff --git a/app/database/seeds/DatabaseSeeder.php b/app/database/seeds/DatabaseSeeder.php index 1989252073..c45bdcb0b9 100644 --- a/app/database/seeds/DatabaseSeeder.php +++ b/app/database/seeds/DatabaseSeeder.php @@ -1,17 +1,21 @@ call('UserTableSeeder'); - } + $this->call('AccountTypeSeeder'); + $this->call('TransactionCurrencySeeder'); + $this->call('TransactionTypeSeeder'); + $this->call('ComponentTypeSeeder'); + } } diff --git a/app/database/seeds/TransactionCurrencySeeder.php b/app/database/seeds/TransactionCurrencySeeder.php new file mode 100644 index 0000000000..ff04c2784e --- /dev/null +++ b/app/database/seeds/TransactionCurrencySeeder.php @@ -0,0 +1,15 @@ +delete(); + + TransactionCurrency::create( + ['code' => 'EUR'] + ); + } + +} \ No newline at end of file diff --git a/app/database/seeds/TransactionTypeSeeder.php b/app/database/seeds/TransactionTypeSeeder.php new file mode 100644 index 0000000000..cb4071b36f --- /dev/null +++ b/app/database/seeds/TransactionTypeSeeder.php @@ -0,0 +1,17 @@ +delete(); + + TransactionType::create(['type' => 'Withdrawal']); + TransactionType::create(['type' => 'Deposit']); + TransactionType::create(['type' => 'Transfer']); + TransactionType::create(['type' => 'Opening balance']); + } + +} \ No newline at end of file diff --git a/app/lib/Firefly/Helper/Email/EmailHelper.php b/app/lib/Firefly/Helper/Email/EmailHelper.php new file mode 100644 index 0000000000..366f9fcf92 --- /dev/null +++ b/app/lib/Firefly/Helper/Email/EmailHelper.php @@ -0,0 +1,40 @@ +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!'); + } + ); + } + +} \ No newline at end of file diff --git a/app/lib/Firefly/Helper/Email/EmailHelperInterface.php b/app/lib/Firefly/Helper/Email/EmailHelperInterface.php new file mode 100644 index 0000000000..4dba74bc30 --- /dev/null +++ b/app/lib/Firefly/Helper/Email/EmailHelperInterface.php @@ -0,0 +1,10 @@ +app->bind( + 'Firefly\Helper\Email\EmailHelperInterface', + 'Firefly\Helper\Email\EmailHelper' + ); + } + +} \ No newline at end of file diff --git a/app/lib/Firefly/Storage/StorageServiceProvider.php b/app/lib/Firefly/Storage/StorageServiceProvider.php new file mode 100644 index 0000000000..5023f78eb8 --- /dev/null +++ b/app/lib/Firefly/Storage/StorageServiceProvider.php @@ -0,0 +1,20 @@ +app->bind( + 'Firefly\Storage\User\UserRepositoryInterface', + 'Firefly\Storage\User\EloquentUserRepository' + ); + } + +} \ No newline at end of file diff --git a/app/lib/Firefly/Storage/User/EloquentUserRepository.php b/app/lib/Firefly/Storage/User/EloquentUserRepository.php new file mode 100644 index 0000000000..d9693e5630 --- /dev/null +++ b/app/lib/Firefly/Storage/User/EloquentUserRepository.php @@ -0,0 +1,44 @@ +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(); + } + +} \ No newline at end of file diff --git a/app/lib/Firefly/Storage/User/UserRepositoryInterface.php b/app/lib/Firefly/Storage/User/UserRepositoryInterface.php new file mode 100644 index 0000000000..4a39c50489 --- /dev/null +++ b/app/lib/Firefly/Storage/User/UserRepositoryInterface.php @@ -0,0 +1,15 @@ +belongsTo('AccountType'); + } + + public function transactions() + { + return $this->hasMany('Transaction'); + } + + public function user() + { + return $this->belongsTo('User'); + } + + + /** + * Get an accounts current balance. + * + * @param \Carbon\Carbon $date + * + * @return float + */ + public function balance(\Carbon\Carbon $date = null) + { + $date = is_null($date) ? new \Carbon\Carbon : $date; + return floatval($this->transactions()->sum('amount')); + } + +} \ No newline at end of file diff --git a/app/models/AccountType.php b/app/models/AccountType.php new file mode 100644 index 0000000000..1cf95abb45 --- /dev/null +++ b/app/models/AccountType.php @@ -0,0 +1,10 @@ +hasMany('Account'); + } + +} \ No newline at end of file diff --git a/app/models/Component.php b/app/models/Component.php new file mode 100644 index 0000000000..cd86792b62 --- /dev/null +++ b/app/models/Component.php @@ -0,0 +1,21 @@ +belongsTo('ComponentType'); + } + + public function transactions() + { + return $this->belongsToMany('Transaction'); + } + + public function user() + { + return $this->belongsTo('User'); + } + +} \ No newline at end of file diff --git a/app/models/ComponentType.php b/app/models/ComponentType.php new file mode 100644 index 0000000000..4e2e49a8d0 --- /dev/null +++ b/app/models/ComponentType.php @@ -0,0 +1,11 @@ +hasMany('Component'); + } + +} \ No newline at end of file diff --git a/app/models/Elegant.php b/app/models/Elegant.php new file mode 100644 index 0000000000..94318f6afa --- /dev/null +++ b/app/models/Elegant.php @@ -0,0 +1,15 @@ +toArray(), + $this::$rules + )->passes(); + } +} \ No newline at end of file diff --git a/app/models/Transaction.php b/app/models/Transaction.php new file mode 100644 index 0000000000..55f848c6df --- /dev/null +++ b/app/models/Transaction.php @@ -0,0 +1,21 @@ +belongsTo('Account'); + } + + public function transactionJournal() + { + return $this->belongsTo('TransactionJournal'); + } + + public function components() + { + return $this->belongsToMany('Component'); + } +} \ No newline at end of file diff --git a/app/models/TransactionCurrency.php b/app/models/TransactionCurrency.php new file mode 100644 index 0000000000..cdc97aea30 --- /dev/null +++ b/app/models/TransactionCurrency.php @@ -0,0 +1,10 @@ +hasMany('TransactionJournal'); + } + +} \ No newline at end of file diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php new file mode 100644 index 0000000000..2947c2bc06 --- /dev/null +++ b/app/models/TransactionJournal.php @@ -0,0 +1,17 @@ +belongsTo('TransactionType'); + } + public function transactionCurrency() { + return $this->belongsTo('TransactionCurrency'); + } + + public function transactions() { + return $this->hasMany('Transaction'); + } + +} \ No newline at end of file diff --git a/app/models/TransactionType.php b/app/models/TransactionType.php new file mode 100644 index 0000000000..ce69ee75eb --- /dev/null +++ b/app/models/TransactionType.php @@ -0,0 +1,9 @@ +hasMany('TransactionJournal'); + } + +} \ No newline at end of file diff --git a/app/models/User.php b/app/models/User.php index af00a49169..16ddbeee20 100644 --- a/app/models/User.php +++ b/app/models/User.php @@ -5,22 +5,32 @@ use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableTrait; use Illuminate\Auth\Reminders\RemindableInterface; -class User extends Eloquent implements UserInterface, RemindableInterface { +class User extends Elegant implements UserInterface, RemindableInterface +{ - use UserTrait, RemindableTrait; + use UserTrait, RemindableTrait; - /** - * The database table used by the model. - * - * @var string - */ - protected $table = 'users'; - /** - * The attributes excluded from the model's JSON form. - * - * @var array - */ - protected $hidden = array('password', 'remember_token'); + /** + * The database table used by the model. + * + * @var string + */ + protected $table = 'users'; + + public static $rules + = [ + 'email' => 'email|unique:users,email', + 'migrated' => 'numeric|between:0,1', + 'password' => 'between:60,60', + 'verification' => 'between:32,32', + ]; + + /** + * The attributes excluded from the model's JSON form. + * + * @var array + */ + protected $hidden = array('password', 'remember_token'); } diff --git a/app/routes.php b/app/routes.php index fbb3af4796..ec948bd205 100644 --- a/app/routes.php +++ b/app/routes.php @@ -1,14 +1,10 @@ 'HomeController@index','as' => 'index','before' => 'auth']); -/* -|-------------------------------------------------------------------------- -| Application Routes -|-------------------------------------------------------------------------- -| -| Here is where you can register all of the routes for an application. -| It's a breeze. Simply tell Laravel the URIs it should respond to -| and give it the Closure to execute when that URI is requested. -| -*/ +// login, register, logout: +Route::get('/login',['uses' => 'UserController@login','as' => 'login','before' => 'guest']); +Route::get('/register',['uses' => 'UserController@register','as' => 'register','before' => 'guest']); +Route::get('/verify/{verification}',['uses' => 'UserController@verify','as' => 'verify','before' => 'guest']); -Route::get('/', ['uses' => 'HomeController@index','as' => 'index']); +Route::post('/login',['uses' => 'UserController@postLogin','before' => 'csrf|guest']); +Route::post('/register',['uses' => 'UserController@postRegister','before' => 'csrf|guest']); diff --git a/app/views/emails/user/register-html.blade.php b/app/views/emails/user/register-html.blade.php new file mode 100644 index 0000000000..b130d167a1 --- /dev/null +++ b/app/views/emails/user/register-html.blade.php @@ -0,0 +1,19 @@ + +
+ + + ++ Hi! +
++ Here's the password you need to login at Firefly: {{$password}} +
++ Cya! +
+ + + \ No newline at end of file diff --git a/app/views/emails/user/register-text.blade.php b/app/views/emails/user/register-text.blade.php new file mode 100644 index 0000000000..7cfa0e4735 --- /dev/null +++ b/app/views/emails/user/register-text.blade.php @@ -0,0 +1,5 @@ +Hi! + +Here's the password you need to login at Firefly: {{$password}} + +Cya! \ No newline at end of file diff --git a/app/views/emails/user/verify-html.blade.php b/app/views/emails/user/verify-html.blade.php new file mode 100644 index 0000000000..3e29447837 --- /dev/null +++ b/app/views/emails/user/verify-html.blade.php @@ -0,0 +1,19 @@ + + + + + ++ Hi! +
++ To verify your registration, please verify your e-mail address. +
++ Cya! +
+ + + \ No newline at end of file diff --git a/app/views/emails/user/verify-text.blade.php b/app/views/emails/user/verify-text.blade.php new file mode 100644 index 0000000000..d37ef85306 --- /dev/null +++ b/app/views/emails/user/verify-text.blade.php @@ -0,0 +1,7 @@ +Hi! + +To verify your registration, please verify your e-mail address: + +{{route('verify',$verification)}} + +Cya! \ No newline at end of file diff --git a/app/views/error.blade.php b/app/views/error.blade.php new file mode 100644 index 0000000000..27aff067df --- /dev/null +++ b/app/views/error.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.guest') +@section('content') +