mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 14:37:02 +01:00
Implement a guest login button, initially hidden
This commit is contained in:
parent
65576b7ffc
commit
0a88e950d6
@ -446,6 +446,10 @@ a {
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#guestlogin_btn {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#modal_invite_btn {
|
#modal_invite_btn {
|
||||||
padding: 0 1em;
|
padding: 0 1em;
|
||||||
}
|
}
|
||||||
|
@ -1489,11 +1489,20 @@
|
|||||||
|
|
||||||
$("#custom_username_field").keyup(function(event){
|
$("#custom_username_field").keyup(function(event){
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
if (!(new RegExp(/^[a-z\d\-_\s]+$/i).test($(this).val()))) {
|
do_guest_login();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#guestlogin_btn").click(function () {
|
||||||
|
do_guest_login();
|
||||||
|
});
|
||||||
|
|
||||||
|
function do_guest_login() {
|
||||||
|
if (!(new RegExp(/^[a-z\d\-_\s]+$/i).test($("#custom_username_field").val()))) {
|
||||||
Materialize.toast('Illegal username provided! Only alphanumeric, spaces, dashes, and underscores allowed in usernames.', 10000);
|
Materialize.toast('Illegal username provided! Only alphanumeric, spaces, dashes, and underscores allowed in usernames.', 10000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($(this).val().length >= 2 && $(this).val().length <= 32) {
|
if($("#custom_username_field").val().length >= 2 && $("#custom_username_field").val().length <= 32) {
|
||||||
$("#custom_username_field").blur();
|
$("#custom_username_field").blur();
|
||||||
if (unauth_captcha_enabled) {
|
if (unauth_captcha_enabled) {
|
||||||
$('#recaptchamodal').modal('open');
|
$('#recaptchamodal').modal('open');
|
||||||
@ -1502,7 +1511,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
$("#submit-unauthenticated-captcha-btn").click(function(){
|
$("#submit-unauthenticated-captcha-btn").click(function(){
|
||||||
lock_login_fields();
|
lock_login_fields();
|
||||||
|
@ -149,6 +149,7 @@
|
|||||||
<p id="guest_login_instr">{{ _("Of course, you also have the option to login by picking a temporary username for your current browsing session.") }}</p>
|
<p id="guest_login_instr">{{ _("Of course, you also have the option to login by picking a temporary username for your current browsing session.") }}</p>
|
||||||
<input id="custom_username_field" type="text" {% if session.unauthenticated and session.username %}value="{{ session['username'] }}"{% endif %}>
|
<input id="custom_username_field" type="text" {% if session.unauthenticated and session.username %}value="{{ session['username'] }}"{% endif %}>
|
||||||
<label id="custom_username_field_label" class="active" for="custom_username_field">{{ _("Username (Hit ENTER/RETURN key to confirm)") }}</label>
|
<label id="custom_username_field_label" class="active" for="custom_username_field">{{ _("Username (Hit ENTER/RETURN key to confirm)") }}</label>
|
||||||
|
<a id="guestlogin_btn" class="waves-effect waves-light btn-large">Guest Login</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user