aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/Http/Controllers/Auth/RegisterController.php1
-rw-r--r--app/Http/Controllers/PublicKeyController.php4
-rw-r--r--app/User.php2
-rw-r--r--database/migrations/2014_10_12_000000_create_users_table.php1
-rw-r--r--database/seeds/DatabaseSeeder.php4
5 files changed, 10 insertions, 2 deletions
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 14f1ef3..f922f9f 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -71,6 +71,7 @@ class RegisterController extends Controller
'name' => $data['name'],
'email' => $data['email'],
'password' => $hashedPassword,
+ 'prevHash' => $previousHash,
'hash' => $summedHash
]);
}
diff --git a/app/Http/Controllers/PublicKeyController.php b/app/Http/Controllers/PublicKeyController.php
index 4557733..0cb714c 100644
--- a/app/Http/Controllers/PublicKeyController.php
+++ b/app/Http/Controllers/PublicKeyController.php
@@ -8,10 +8,14 @@ use Cookie;
use Illuminate\Foundation\Auth\User;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Hash;
+
class PublicKeyController extends Controller
{
public function getUsersKey($user_id)
{
+ return Hash::check();
+
$public_key = PublicKeys::select('key')->where('user_id', $user_id)->first();
// TODO: Friends: do not allow to request every public key
diff --git a/app/User.php b/app/User.php
index d8caf1e..923e2cc 100644
--- a/app/User.php
+++ b/app/User.php
@@ -13,7 +13,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
- 'name', 'email', 'password', 'hash'
+ 'name', 'email', 'password', 'prevHash','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 55e1804..9281465 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('prevHash', 60)->unique();
$table->string('hash', 60)->unique();
$table->rememberToken();
$table->timestamps();
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index b31b7e0..1f7953b 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -18,13 +18,15 @@ class DatabaseSeeder extends Seeder
'name' => 'genesis',
'email' => ' ',
'password' => ' ',
- 'hash' => bcrypt('genesis')
+ 'prevHash' => '0',
+ 'hash' => Hash::make('genesis')
]);
DB::table('users')->insert([
'name' => 'Marvin Borner',
'email' => 'marvin@borners.de',
'password' => Hash::make('password'),
+ 'prevHash' => Hash::make('genesis'),
'hash' => Hash::make(Hash::make('genesis') . 'Marvin Borner' . 'marvin@borners.de' . Hash::make('password')) // hashing: prev hash, all fields in current 'block'
]);
}