mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-23 01:26:46 +00:00
Added dashes and underscores to permitted characters
This commit is contained in:
parent
1322569cf6
commit
89eb5526ce
@ -6,7 +6,7 @@ import java.util.regex.Pattern;
|
|||||||
public class Utils {
|
public class Utils {
|
||||||
private static final Random random = new Random(System.currentTimeMillis());
|
private static final Random random = new Random(System.currentTimeMillis());
|
||||||
|
|
||||||
private static final String SHORT_URL_PATTERN = "[a-z0-9]+";
|
private static final String SHORT_URL_PATTERN = "[a-z0-9_-]+";
|
||||||
private static final Pattern PATTERN = Pattern.compile(SHORT_URL_PATTERN);
|
private static final Pattern PATTERN = Pattern.compile(SHORT_URL_PATTERN);
|
||||||
|
|
||||||
public static String randomString() {
|
public static String randomString() {
|
||||||
|
@ -33,9 +33,10 @@
|
|||||||
<input type="url" name="longUrl" id="longUrl" placeholder="Long URL" required/>
|
<input type="url" name="longUrl" id="longUrl" placeholder="Long URL" required/>
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="shortUrl">Short URL (Optional)</label>
|
<label for="shortUrl">Short URL (Optional). Only letters, number dashes and underscores
|
||||||
|
permitted</label>
|
||||||
<input type="text" name="shortUrl" id="shortUrl" placeholder="Short URL (optional)"
|
<input type="text" name="shortUrl" id="shortUrl" placeholder="Short URL (optional)"
|
||||||
pattern="[a-z0-9]+"/>
|
pattern="[a-z0-9_-]+"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-controls">
|
<div class="pure-controls">
|
||||||
<button class="pure-button pure-button-primary">Submit</button>
|
<button class="pure-button pure-button-primary">Submit</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user