mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-25 20:08:23 +02:00
Initial work on domain create and transfers
This commit is contained in:
parent
0853030237
commit
8f88bc9e6c
5 changed files with 220 additions and 5 deletions
|
@ -55,4 +55,14 @@ class DomainsController extends Controller
|
|||
// Default view for GET requests or if POST data is not set
|
||||
return view($response,'admin/domains/check.twig');
|
||||
}
|
||||
|
||||
public function create(Request $request, Response $response)
|
||||
{
|
||||
return view($response,'admin/domains/create.twig');
|
||||
}
|
||||
|
||||
public function transfers(Request $request, Response $response)
|
||||
{
|
||||
return view($response,'admin/domains/transfers.twig');
|
||||
}
|
||||
}
|
136
cp/resources/views/admin/domains/create.twig
Normal file
136
cp/resources/views/admin/domains/create.twig
Normal file
|
@ -0,0 +1,136 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}{{ __('Create Domain') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-wrapper">
|
||||
<!-- Page header -->
|
||||
<div class="page-header d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col">
|
||||
<!-- Page pre-title -->
|
||||
<div class="page-pretitle">
|
||||
Overview
|
||||
</div>
|
||||
<h2 class="page-title">
|
||||
{{ __('Create Domain') }}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form id="domainCreateForm" action="/your_endpoint" method="post">
|
||||
<h6>Your Domain Name</h6>
|
||||
<div class="mb-3">
|
||||
<input type="text" class="form-control mb-2" placeholder="example.com" name="domainName" required>
|
||||
</div>
|
||||
|
||||
<!-- Slider for years -->
|
||||
<div class="mb-3">
|
||||
<label for="registrationYears">Registration Years</label>
|
||||
<input type="range" class="form-range" min="1" max="10" step="1" id="registrationYears" name="registrationYears" value="1">
|
||||
<span id="yearValue">1 Year</span>
|
||||
</div>
|
||||
|
||||
<!-- Fields for 4 contacts -->
|
||||
<h6>Contacts</h6>
|
||||
<div class="mb-3">
|
||||
<input type="text" class="form-control mb-2" placeholder="Contact 1" name="contact1" required>
|
||||
<input type="text" class="form-control mb-2" placeholder="Contact 2" name="contact2" required>
|
||||
<input type="text" class="form-control mb-2" placeholder="Contact 3" name="contact3" required>
|
||||
<input type="text" class="form-control mb-2" placeholder="Contact 4" name="contact4" required>
|
||||
</div>
|
||||
|
||||
<!-- Fields for nameservers -->
|
||||
<h6>Nameservers</h6>
|
||||
<div id="nameserverFields">
|
||||
<input type="text" class="form-control mb-2" placeholder="Nameserver 1" name="nameserver1" required>
|
||||
<input type="text" class="form-control mb-2" placeholder="Nameserver 2" name="nameserver2" required>
|
||||
</div>
|
||||
<button type="button" id="addNameserver" class="btn btn-success btn-sm mb-2">+</button>
|
||||
<button type="button" id="removeNameserver" class="btn btn-danger btn-sm mb-2">-</button>
|
||||
|
||||
<!-- AuthInfo -->
|
||||
<div class="mb-3">
|
||||
<label for="authInfo">Auth Info</label>
|
||||
<input type="text" class="form-control" id="authInfo" name="authInfo" readonly>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer footer-transparent d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||
<ul class="list-inline list-inline-dots mb-0">
|
||||
<li class="list-inline-item">
|
||||
Copyright © 2023
|
||||
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const yearSlider = document.getElementById('registrationYears');
|
||||
const yearValueDisplay = document.getElementById('yearValue');
|
||||
const addNameserverBtn = document.getElementById('addNameserver');
|
||||
const removeNameserverBtn = document.getElementById('removeNameserver');
|
||||
const nameserverFields = document.getElementById('nameserverFields');
|
||||
const authInfoField = document.getElementById('authInfo');
|
||||
|
||||
// Display year value from slider
|
||||
yearSlider.addEventListener('input', function() {
|
||||
yearValueDisplay.textContent = `${yearSlider.value} Year${yearSlider.value > 1 ? 's' : ''}`;
|
||||
});
|
||||
|
||||
// Add nameserver field
|
||||
let nameserverCount = 2;
|
||||
addNameserverBtn.addEventListener('click', function() {
|
||||
if (nameserverCount < 13) {
|
||||
nameserverCount++;
|
||||
const newField = document.createElement('input');
|
||||
newField.type = 'text';
|
||||
newField.className = 'form-control mb-2';
|
||||
newField.placeholder = `Nameserver ${nameserverCount}`;
|
||||
newField.name = `nameserver${nameserverCount}`;
|
||||
nameserverFields.appendChild(newField);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove nameserver field
|
||||
removeNameserverBtn.addEventListener('click', function() {
|
||||
if (nameserverCount > 2) {
|
||||
nameserverFields.removeChild(nameserverFields.lastChild);
|
||||
nameserverCount--;
|
||||
}
|
||||
});
|
||||
|
||||
// Generate random AuthInfo and set it to the field
|
||||
function generateAuthInfo() {
|
||||
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < 10; i++) {
|
||||
result += charset.charAt(Math.floor(Math.random() * charset.length));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
authInfoField.value = generateAuthInfo();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
67
cp/resources/views/admin/domains/transfers.twig
Normal file
67
cp/resources/views/admin/domains/transfers.twig
Normal file
|
@ -0,0 +1,67 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}{{ __('Check Domain') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-wrapper">
|
||||
<!-- Page header -->
|
||||
<div class="page-header d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col">
|
||||
<!-- Page pre-title -->
|
||||
<div class="page-pretitle">
|
||||
Overview
|
||||
</div>
|
||||
<h2 class="page-title">
|
||||
{{ __('Check Domain') }}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom py-3">
|
||||
<p class="mb-4">{{ __('Enter the domain name you want to check:') }}</p>
|
||||
<form action="/domain/check" method="POST">
|
||||
{{ csrf.field | raw }}
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="yourdomain.com" name="domain_name" required="required">
|
||||
<button type="submit" class="btn btn-primary">{{ __('Check Availability') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{% if isAvailable is defined and domainName is defined %}
|
||||
{% if isAvailable %}
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ domainName }} {{ __('is available') }}!
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ domainName }} {{ __('is not available') }}: {{ status }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer footer-transparent d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||
<ul class="list-inline list-inline-dots mb-0">
|
||||
<li class="list-inline-item">
|
||||
Copyright © 2023
|
||||
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -167,7 +167,7 @@
|
|||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {{ is_current_url('domains') or is_current_url('domaincheck') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||
<li {{ is_current_url('domains') or is_current_url('domaincheck') or is_current_url('domaincreate') or is_current_url('transfers') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
|
||||
<span class="nav-link-icon d-md-none d-lg-inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path><path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path><path d="M12.5 3a16.989 16.989 0 0 1 1.828 4"></path><path d="M19.5 17a9 9 0 0 1 -7.5 4a8.991 8.991 0 0 1 -7.484 -4"></path><path d="M11.5 21a16.989 16.989 0 0 1 -1.826 -4"></path><path d="M12.5 21a16.989 16.989 0 0 0 1.828 -4"></path><path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path> <path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path></svg>
|
||||
</span>
|
||||
|
@ -182,7 +182,7 @@
|
|||
<a class="dropdown-item" href="{{route('domaincheck')}}">
|
||||
{{ __('Check Domain') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="#">
|
||||
<a class="dropdown-item" href="{{route('domaincreate')}}">
|
||||
{{ __('Create Domain') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
@ -193,7 +193,7 @@
|
|||
{{ __('Create Application') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#">
|
||||
<a class="dropdown-item" href="{{route('transfers')}}">
|
||||
{{ __('Transfers') }}
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -41,13 +41,15 @@ $app->group('', function ($route) {
|
|||
|
||||
$route->get('/domains', DomainsController::class .':view')->setName('domains');
|
||||
$route->map(['GET', 'POST'], '/domain/check', DomainsController::class . ':check')->setName('domaincheck');
|
||||
$route->map(['GET', 'POST'], '/domain/create', DomainsController::class . ':create')->setName('domaincreate');
|
||||
$route->map(['GET', 'POST'], '/transfers', DomainsController::class . ':transfers')->setName('transfers');
|
||||
|
||||
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
|
||||
$route->map(['GET', 'POST'], '/contact/create', ContactsController::class . ':create')->setName('contactcreate');
|
||||
|
||||
|
||||
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
||||
$route->map(['GET', 'POST'], '/host/create', HostsController::class . ':create')->setName('hostcreate');
|
||||
|
||||
|
||||
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
|
||||
$route->get('/logs', LogsController::class .':view')->setName('logs');
|
||||
$route->get('/reports', ReportsController::class .':view')->setName('reports');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue