aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2018-06-26 23:18:58 +0200
committerCamil Staps2018-06-26 23:18:58 +0200
commit18772a01928fdd6410626d13bba1b0a82c1c2842 (patch)
tree71d0fbdfb45d373aadda45b22d51a88964e16cbf
parentAdd CSRF tokens to views (diff)
Don't store CSRF _token in logs
-rw-r--r--app/RandomLog.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/RandomLog.php b/app/RandomLog.php
index a90018c..f0fefb9 100644
--- a/app/RandomLog.php
+++ b/app/RandomLog.php
@@ -26,10 +26,17 @@ class RandomLog extends Model {
public $timestamps = false;
protected $fillable = ['request', 'response'];
- public static function boot() {
+ public static function boot() {
static::creating(function ($model) {
$model->created_at = $model->freshTimestamp();
});
}
+ public function setRequestAttribute($value) {
+ $value = json_decode($value, true);
+ unset($value['_token']);
+ $value = json_encode($value);
+ $this->attributes['request'] = $value;
+ }
+
}