Browse Source

fix active option detection

PHP-GTK3
yggverse 4 months ago
parent
commit
51e62ece26
  1. 74
      src/Entity/Browser/Container/Page/Auth.php

74
src/Entity/Browser/Container/Page/Auth.php

@ -190,48 +190,52 @@ class Auth
// Listen for user chose // Listen for user chose
if (GtkResponseType::OK == $this->gtk->run()) if (GtkResponseType::OK == $this->gtk->run())
{ {
// Get active option // Find active option
foreach ($this->_options as $id => $option) foreach ($this->_options as $id => $option)
{ {
// Auth if ($option->get_active())
if ($id)
{ {
// @TODO activate existing record // Auth
} if ($id)
// Generate new identity
else
{
// Detect driver
switch (true)
{ {
case mb_strtolower( // @TODO activate existing record
parse_url( }
$this->page->navbar->request->getValue(),
PHP_URL_SCHEME
)
) == 'gemini':
// Init identity model
$identity = new Gemini;
// Add new auth record
$this->page->container->browser->database->auth->add(
$this->page->container->browser->database->identity->add(
$identity->crt(),
$identity->key(),
$this->_name->get_text() ? $this->_name->get_text() : null
),
$this->page->navbar->request->getValue()
);
break;
default:
throw new Exception; // Generate new identity
else
{
// Detect driver
switch (true)
{
case mb_strtolower(
parse_url(
$this->page->navbar->request->getValue(),
PHP_URL_SCHEME
)
) == 'gemini':
// Init identity model
$identity = new Gemini;
// Add new auth record
$this->page->container->browser->database->auth->add(
$this->page->container->browser->database->identity->add(
$identity->crt(),
$identity->key(),
$this->_name->get_text() ? $this->_name->get_text() : null
),
$this->page->navbar->request->getValue()
);
break;
default:
throw new Exception;
}
} }
} }
} }
$this->gtk->destroy(); $this->gtk->destroy();

Loading…
Cancel
Save