diff --git a/js/dist/admin.js b/js/dist/admin.js index 4459328..9a933c9 100644 Binary files a/js/dist/admin.js and b/js/dist/admin.js differ diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 8aae698..7eef73c 100644 Binary files a/js/dist/admin.js.map and b/js/dist/admin.js.map differ diff --git a/js/src/admin/pages/ClientsPage.js b/js/src/admin/pages/ClientsPage.js index ea80fe8..90f993b 100644 --- a/js/src/admin/pages/ClientsPage.js +++ b/js/src/admin/pages/ClientsPage.js @@ -66,10 +66,12 @@ export default class ClientsPage extends Page { className: 'Button Button--block', onclick: () => { const client = app.store.createRecord('oauth-clients'); + const client_id = this.randomString(32); + const client_secret = this.randomString(32); client.save({ - client_id: this.randomString(32), - client_secret: this.randomString(32), - }).then(console.log); + client_id: client_id, + client_secret: client_secret, + }).then(this.clients.push(client)); // this.clients.push(Client.build({ // diff --git a/src/Models/Client.php b/src/Models/Client.php index 840b713..c9e2c98 100644 --- a/src/Models/Client.php +++ b/src/Models/Client.php @@ -15,4 +15,17 @@ use Flarum\Database\AbstractModel; class Client extends AbstractModel { protected $table = 'oauth_clients'; + + protected $guarded = []; + + public static function build(string $client_id, string $client_secret, int $user_id) + { + $client = new static(); + + $client->client_id = $client_id; + $client->client_secret = $client_secret; + $client->user_id = $user_id; + + return $client; + } }