Skip to content

Commit 5abcf0c

Browse files
author
Chad Shaw
committed
add patern matching for ip addresses
1 parent 1e33e39 commit 5abcf0c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

templates/modals/bootmodal.templ

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@
5353

5454
<div class="form-control mt-4">
5555
<label class="label"><span class="label-text">IP Address</span></label>
56-
<input type="text" name="ip" value="{{ .ip }}" class="input input-bordered" required/>
56+
<input type="text" name="ip" value="{{ .ip }}" placeholder="192.168.1.100" class="input input-bordered" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 192.168.1.100)" required/>
5757
</div>
5858

5959
<div class="form-control mt-4">
6060
<label class="label"><span class="label-text">Subnet Mask</span></label>
61-
<input type="text" name="subnet" value="{{ .subnet }}" class="input input-bordered" required/>
61+
<input type="text" name="subnet" value="{{ .subnet }}" placeholder="255.255.255.0" class="input input-bordered" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid subnet mask (e.g., 255.255.255.0)" required/>
6262
</div>
6363

6464
<div class="form-control mt-4">
6565
<label class="label"><span class="label-text">Gateway</span></label>
66-
<input type="text" name="gateway" value="{{ .gateway }}" class="input input-bordered" required/>
66+
<input type="text" name="gateway" value="{{ .gateway }}" placeholder="192.168.1.1" class="input input-bordered" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 192.168.1.1)" required/>
6767
</div>
6868

6969
<div class="form-control mt-4">
7070
<label class="label"><span class="label-text">DNS Server</span></label>
71-
<input type="text" name="dns" value="{{ .dns }}" class="input input-bordered" required/>
71+
<input type="text" name="dns" value="{{ .dns }}" placeholder="8.8.8.8" class="input input-bordered" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 8.8.8.8)" required/>
7272
</div>
7373
</div>
7474
</div>
@@ -79,4 +79,4 @@
7979
</div>
8080
</form>
8181
</div>
82-
</div>
82+
</div>

templates/modals/dhcpmodal.templ

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@
1818
<label class="label">
1919
<span class="label-text">Subnet Mask</span>
2020
</label>
21-
<input type="text" name="subnet" placeholder="e.g., 255.255.255.0" class="input input-bordered" id="subnet" required />
21+
<input type="text" name="subnet" placeholder="255.255.255.0" class="input input-bordered" id="subnet" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid subnet mask (e.g., 255.255.255.0)" required />
2222
</div>
2323

2424
<div class="form-control mt-4">
2525
<label class="label">
2626
<span class="label-text">Gateway IP</span>
2727
</label>
28-
<input type="text" name="gateway" placeholder="e.g., 192.168.1.1" class="input input-bordered" id="gateway" required />
28+
<input type="text" name="gateway" placeholder="192.168.1.1" class="input input-bordered" id="gateway" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 192.168.1.1)" required />
2929
</div>
3030

3131
<div class="form-control mt-4">
3232
<label class="label">
3333
<span class="label-text">DNS IP</span>
3434
</label>
35-
<input type="text" name="dns" placeholder="e.g., 8.8.8.8" class="input input-bordered" id="dns" required />
35+
<input type="text" name="dns" placeholder="8.8.8.8" class="input input-bordered" id="dns" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 8.8.8.8)" required />
3636
</div>
3737

3838
<div class="form-control mt-4">
3939
<label class="label">
4040
<span class="label-text">Start IP</span>
4141
</label>
42-
<input type="text" name="startIP" placeholder="e.g., 192.168.1.100" class="input input-bordered" id="startIP" required />
42+
<input type="text" name="startIP" placeholder="192.168.1.100" class="input input-bordered" id="startIP" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 192.168.1.100)" required />
4343
</div>
4444

4545
<div class="form-control mt-4">
@@ -55,4 +55,4 @@
5555
</div>
5656
</form>
5757
</div>
58-
</div>
58+
</div>

templates/modals/ipmimodal.templ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<form id="ipmiForm" hx-post="/pxe/submit_ipmi" hx-target="body" hx-swap="innerHTML">
55
<div class="form-control">
66
<label class="label"><span class="label-text">IPMI IP</span></label>
7-
<input type="text" name="ip" placeholder="Enter IP Address" value="{{ .ip }}" class="input input-bordered" required />
7+
<input type="text" name="ip" placeholder="192.168.1.100" value="{{ .ip }}" class="input input-bordered" pattern="^((\d{1,3}\.){3}\d{1,3})$" title="Enter a valid IP address (e.g., 192.168.1.100)" required />
88
</div>
99

1010
<div class="form-control mt-4">
@@ -42,4 +42,4 @@
4242
</div>
4343
</form>
4444
</div>
45-
</div>
45+
</div>

0 commit comments

Comments
 (0)