diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-12-17 14:44:50 -0800 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-12-17 14:44:50 -0800 |
commit | e5fb668bd3cac70ed27c2111234e042e8f70fff8 (patch) | |
tree | f910118e8308d6796badbb9b3878c7c3a91bff4e | |
parent | 2b98a4548e82f1133bf62918b0106ab99a21fa29 (diff) |
auto prefix http:// in sign-in form
fixes #48
-rw-r--r-- | public/js/script.js | 8 | ||||
-rw-r--r-- | views/index.php | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/public/js/script.js b/public/js/script.js index 50496d3..f6f3a48 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -39,3 +39,11 @@ $(function(){ }); }) + +function auto_prefix_url_field(field) { + var str = field.value; + if(!/^https?:\/\//.test(str)) { + str = "http://" + str; + } + field.value = str; +} diff --git a/views/index.php b/views/index.php index 3ed34c2..b06f097 100644 --- a/views/index.php +++ b/views/index.php @@ -8,7 +8,7 @@ <p>To use Quill, sign in with your domain. Your website will need to support <a href="http://indiewebcamp.com/micropub">Micropub</a> for creating new posts.</p> <form action="/auth/start" method="get" class="form-inline"> - <input type="url" name="me" placeholder="http://example.com" value="" class="form-control"> + <input type="url" name="me" placeholder="https://example.com" value="" class="form-control" onchange="auto_prefix_url_field(this)"> <input type="submit" value="Sign In" class="btn btn-primary"> <input type="hidden" name="client_id" value="https://quill.p3k.io"> <input type="hidden" name="redirect_uri" value="https://quill.p3k.io/auth/callback"> |