aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/Exceptions/Handler.php2
-rw-r--r--app/Http/Controllers/Auth/RegisterController.php7
-rw-r--r--app/User.php2
-rw-r--r--database/migrations/2014_10_12_000000_create_users_table.php1
-rw-r--r--database/migrations/2018_07_07_104937_create_public_keys_table.php2
-rw-r--r--database/seeds/DatabaseSeeder.php16
6 files changed, 25 insertions, 5 deletions
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 0e458d9..987fc82 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -52,7 +52,7 @@ class Handler extends ExceptionHandler
$statusCode = $exception->getStatusCode();
switch ($statusCode) {
case '404':
- $codeMessage = 'Page could not be found';
+ $codeMessage = 'Page could not be found.';
}
$errorMessage = $exception->getMessage() == '' ? ($codeMessage ? $codeMessage : 'An unknown error occurred.') : $exception->getMessage();
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index fb7a4c1..a051071 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -63,10 +63,15 @@ class RegisterController extends Controller
*/
protected function create(array $data)
{
+ $hashedPassword = Hash::make($data['password']);
+ $previousHash = User::select('hash')->orderBy('id','desc')->first();
+ $summedHash = bcrypt($previousHash . $data['name'] . $data['email'] . 'password' . $hashedPassword);
+
return User::create([
'name' => $data['name'],
'email' => $data['email'],
- 'password' => Hash::make($data['password']),
+ 'password' => $hashedPassword,
+ 'hash' => $summedHash
]);
}
}
diff --git a/app/User.php b/app/User.php
index 4d6d0ee..d8caf1e 100644
--- a/app/User.php
+++ b/app/User.php
@@ -13,7 +13,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
- 'name', 'email', 'password',
+ 'name', 'email', 'password', 'hash'
];
/**
diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php
index 6751167..55e1804 100644
--- a/database/migrations/2014_10_12_000000_create_users_table.php
+++ b/database/migrations/2014_10_12_000000_create_users_table.php
@@ -18,6 +18,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->string('password');
$table->string('avatar')->default('0.png');
+ $table->string('hash', 60)->unique();
$table->rememberToken();
$table->timestamps();
});
diff --git a/database/migrations/2018_07_07_104937_create_public_keys_table.php b/database/migrations/2018_07_07_104937_create_public_keys_table.php
index 5a1dda4..c9d548e 100644
--- a/database/migrations/2018_07_07_104937_create_public_keys_table.php
+++ b/database/migrations/2018_07_07_104937_create_public_keys_table.php
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreatePublicKeyTable extends Migration
+class CreatePublicKeysTable extends Migration
{
/**
* Run the migrations.
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index 91cb6d1..db0f2fd 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder
{
@@ -11,6 +12,19 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
- // $this->call(UsersTableSeeder::class);
+ DB::table('users')->insert([
+ 'id' => 0,
+ 'name' => 'genesis',
+ 'email' => ' ',
+ 'password' => ' ',
+ 'hash' => bcrypt('genesis')
+ ]);
+
+ DB::table('users')->insert([
+ 'name' => 'Marvin Borner',
+ 'email' => 'marvin@borners.de',
+ 'password' => bcrypt('password'),
+ 'hash' => bcrypt(bcrypt('genesis') . 'Marvin Borner'. 'marvin@borners.de'. 'password') // hashing: prev hash, all fields in current 'block'
+ ]);
}
}