mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-24 02:44:51 +03:00
_JEXEC & copyright
This commit is contained in:
parent
ffc26f48a8
commit
16f1f08808
@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Model;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Model;
|
||||||
|
|
||||||
@ -7,6 +14,8 @@ use Joomla\CMS\Factory;
|
|||||||
use Joomla\CMS\Form\Form;
|
use Joomla\CMS\Form\Form;
|
||||||
use Joomla\CMS\MVC\Model\AdminModel;
|
use Joomla\CMS\MVC\Model\AdminModel;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
class ClientModel extends AdminModel
|
class ClientModel extends AdminModel
|
||||||
{
|
{
|
||||||
use GetItemByIdentifierTrait;
|
use GetItemByIdentifierTrait;
|
||||||
@ -22,6 +31,7 @@ class ClientModel extends AdminModel
|
|||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param bool $loadData
|
* @param bool $loadData
|
||||||
|
*
|
||||||
* @return \Joomla\CMS\Form\Form|bool
|
* @return \Joomla\CMS\Form\Form|bool
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since version
|
* @since version
|
||||||
@ -30,7 +40,8 @@ class ClientModel extends AdminModel
|
|||||||
{
|
{
|
||||||
$form = $this->loadForm('com_oauthserver.client', 'client', ['control' => 'jform', 'load_data' => $loadData]);
|
$form = $this->loadForm('com_oauthserver.client', 'client', ['control' => 'jform', 'load_data' => $loadData]);
|
||||||
|
|
||||||
if (empty($form)) {
|
if (empty($form))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +61,8 @@ class ClientModel extends AdminModel
|
|||||||
// Check the session for previously entered form data.
|
// Check the session for previously entered form data.
|
||||||
$data = Factory::getApplication()->getUserState('com_oauthserver.edit.client.data', []);
|
$data = Factory::getApplication()->getUserState('com_oauthserver.edit.client.data', []);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data))
|
||||||
|
{
|
||||||
$data = $this->getItem();
|
$data = $this->getItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +80,7 @@ class ClientModel extends AdminModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Webmasterskaya\Component\OauthServer\Administrator\Table\ClientTable $table
|
* @param \Webmasterskaya\Component\OauthServer\Administrator\Table\ClientTable $table
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since version
|
* @since version
|
||||||
@ -78,15 +91,20 @@ class ClientModel extends AdminModel
|
|||||||
$input = $app->getInput();
|
$input = $app->getInput();
|
||||||
$task = strtolower($input->getCmd('task', ''));
|
$task = strtolower($input->getCmd('task', ''));
|
||||||
|
|
||||||
if ($task === 'save2reset' || empty($table->id)) {
|
if ($task === 'save2reset' || empty($table->id))
|
||||||
|
{
|
||||||
$table->identifier = $this->generateNewIdentifier();
|
$table->identifier = $this->generateNewIdentifier();
|
||||||
$table->secret = !!$table->public ? '' : $this->generateNewSecret();
|
$table->secret = !!$table->public ? '' : $this->generateNewSecret();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!$table->public) {
|
if (!!$table->public)
|
||||||
|
{
|
||||||
$table->secret = '';
|
$table->secret = '';
|
||||||
} else {
|
}
|
||||||
if (empty($table->secret)) {
|
else
|
||||||
|
{
|
||||||
|
if (empty($table->secret))
|
||||||
|
{
|
||||||
$table->secret = $this->generateNewSecret();
|
$table->secret = $this->generateNewSecret();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user