fix(admin): create client
This commit is contained in:
parent
1985bd68ca
commit
6c537e4b80
4 changed files with 18 additions and 3 deletions
BIN
js/dist/admin.js
generated
vendored
BIN
js/dist/admin.js
generated
vendored
Binary file not shown.
BIN
js/dist/admin.js.map
generated
vendored
BIN
js/dist/admin.js.map
generated
vendored
Binary file not shown.
|
@ -66,10 +66,12 @@ export default class ClientsPage extends Page {
|
||||||
className: 'Button Button--block',
|
className: 'Button Button--block',
|
||||||
onclick: () => {
|
onclick: () => {
|
||||||
const client = app.store.createRecord('oauth-clients');
|
const client = app.store.createRecord('oauth-clients');
|
||||||
|
const client_id = this.randomString(32);
|
||||||
|
const client_secret = this.randomString(32);
|
||||||
client.save({
|
client.save({
|
||||||
client_id: this.randomString(32),
|
client_id: client_id,
|
||||||
client_secret: this.randomString(32),
|
client_secret: client_secret,
|
||||||
}).then(console.log);
|
}).then(this.clients.push(client));
|
||||||
|
|
||||||
// this.clients.push(Client.build({
|
// this.clients.push(Client.build({
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,4 +15,17 @@ use Flarum\Database\AbstractModel;
|
||||||
class Client extends AbstractModel
|
class Client extends AbstractModel
|
||||||
{
|
{
|
||||||
protected $table = 'oauth_clients';
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue