API key UI changes and backend storage of the keys
This commit is contained in:
parent
69e67b5e2d
commit
47e14ccaae
11 changed files with 136 additions and 160 deletions
|
@ -19,6 +19,8 @@ class APIKey extends Model implements CleansAttributes, ValidableContract
|
|||
{
|
||||
use Eloquence, Validable;
|
||||
|
||||
const KEY_LENGTH = 32;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
|
@ -26,13 +28,6 @@ class APIKey extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected $table = 'api_keys';
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = ['secret'];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
*
|
||||
|
@ -57,8 +52,7 @@ class APIKey extends Model implements CleansAttributes, ValidableContract
|
|||
protected static $applicationRules = [
|
||||
'memo' => 'required',
|
||||
'user_id' => 'required',
|
||||
'secret' => 'required',
|
||||
'public' => 'required',
|
||||
'token' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -68,8 +62,7 @@ class APIKey extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'user_id' => 'exists:users,id',
|
||||
'public' => 'string|size:16',
|
||||
'secret' => 'string',
|
||||
'token' => 'string|size:32',
|
||||
'memo' => 'nullable|string|max:500',
|
||||
'allowed_ips' => 'nullable|json',
|
||||
'expires_at' => 'nullable|datetime',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue