Browse Source

Record when password changes happen

merge-requests/2/head
Vincent Canfield 3 years ago
parent
commit
1ce24a6734

+ 5
- 0
app/Http/Controllers/UserController.php View File

@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use Hash;
use Validator;
use Auth;
use App\PasswordChange;

class UserController extends Controller {

@@ -41,6 +42,10 @@ class UserController extends Controller {
$user->password = Hash::make($request->password);
$user->save();

$password_change = new PasswordChange();
$password_change->user_id = $user->id;
$password_change->save();

return redirect('/user/changepass')->with('message','Your password has been changed!');
}

+ 11
- 0
app/PasswordChange.php View File

@@ -0,0 +1,11 @@
<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class PasswordChange extends Model {

public function user() {
return $this->belongsTo('App\User');
}

}

+ 4
- 0
app/User.php View File

@@ -29,4 +29,8 @@ class User extends Model implements AuthenticatableContract {
*/
protected $hidden = ['password', 'remember_token'];

public function passwordChanges() {
return $this->hasMany('App\PasswordChange');
}

}

+ 33
- 0
database/migrations/2016_07_10_154248_create_password_changes_table.php View File

@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePasswordChangesTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_changes', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('password_changes');
}

}

+ 3
- 0
resources/views/pages/privacy.blade.php View File

@@ -4,6 +4,8 @@

@section('content')

<p>This page was last modified on: 2016-07-10. View changes <a href="https://gitgud.io/vc/cock.li/commits/master/resources/views/pages/privacy.blade.php">here</a>.</p>

<h4>Information stored via web servers</h4>
<p>
When you visit a page on cock.li, your IP address, user agent, and referer are saved forever. I do this for historical analytics and other cool graph stuff. Some day I'd like to anonymize this data automatically while keeping geoip info, but for now that is not the case.
@@ -40,6 +42,7 @@
<ul>
<li>Registering IP address</li>
<li>Time registered</li>
<li>Password changes (only user ID and time are recorded)</li>
</ul>
<li>Data stored for 2 days:</li>
<ul>

+ 2
- 0
resources/views/pages/tos.blade.php View File

@@ -4,6 +4,8 @@

@section('content')

<p>This page was last modified on: 2016-02-07. View changes <a href="https://gitgud.io/vc/cock.li/commits/master/resources/views/pages/tos.blade.php">here</a>.</p>

<h4>The "Don't sue me" disclaimer</h4>
<p>This service is provided as-is with no warranty, express or implied. I am under no legal obligation to provide you with service, or keep the service I provide consistent. Don't fucking sue me over shit I don't have an obligation to provide, basically.</p>


Loading…
Cancel
Save