Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

459 login does not work when character is part of user name backport #461

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.rst
Expand Up @@ -12,13 +12,17 @@ End-User Summary
- Starting with branch of stable version Athenea (VarFish v1).
- Documenting problem with extra annotations in ``20210728` data release (#450).
Includes instructions on how to apply patch to get ``20210728b``.
- Removing problematic username modification behaviour on login page (#459).
- Displaying login page text from settings again (#458).

Full Change List
================

- Starting with branch of stable version Athenea (VarFish v1).
- Documenting problem with extra annotations in ``20210728` data release (#450).
Includes instructions on how to apply patch to get ``20210728b``.
- Removing problematic username modification behaviour on login page (#459).
- Displaying login page text from settings again (#458).

------
v1.2.0
Expand Down
58 changes: 0 additions & 58 deletions varfish/static/js/login.js
@@ -1,58 +0,0 @@
/* Autofill domain in login username ---------------------------------------- */

$(document).ready(function() {
$('#sodar-login-username').keyup(function(event) {
var maxLength = 255;
v = $(this).val();

// Fill domain
if (event.keyCode !== 8 && v.length > 3 &&
v.indexOf('@') > 0 && v.indexOf('@') < v.length - 1) {
var domainName = null;

if (v.charAt(v.indexOf('@') + 1).toUpperCase() === 'C') {
$(this).removeClass('text-danger');
$('#sodar-login-submit').removeClass('disabled');
domainName = 'CHARITE';
}

else if (v.charAt(v.indexOf('@') + 1).toUpperCase() === 'M') {
$(this).removeClass('text-danger');
$('#sodar-login-submit').removeClass('disabled');
domainName = 'MDC-BERLIN';
}

// Gently inform the user of an invalid domain :)
else {
$(this).addClass('text-danger');
$('#sodar-login-submit').addClass('disabled');
}

if (domainName !== null) {
$(this).val(v.substring(0, v.indexOf('@') + 1) + domainName);
$(this).attr('maxlength', $(this).val().length);
}
}

// Erase domain if backspace is pressed
else if (event.keyCode === 8 && v.indexOf('@') > 0) {
$(this).val(v.substring(0, v.indexOf('@') + 1));
$(this).addClass('text-danger');
$('#sodar-login-submit').addClass('disabled');
$(this).attr('maxlength', maxLength);
}

// Don't allow login if there is an empty domain
if (v.indexOf('@') === v.length - 1) {
$(this).addClass('text-danger');
$('#sodar-login-submit').addClass('disabled');
}

// User without domain is OK (only for local admin/test users)
else if (v.indexOf('@') === -1) {
$(this).removeClass('text-danger');
$('#sodar-login-submit').removeClass('disabled');
$(this).attr('maxlength', maxLength);
}
});
});
2 changes: 2 additions & 0 deletions varfish/templates/users/login.html
Expand Up @@ -4,6 +4,7 @@
{% load static %}
{% load projectroles_tags %}
{% load projectroles_common_tags %}
{% load variants_tags %}

{% get_django_setting 'SITE_INSTANCE_TITLE' as site_title %}

Expand Down Expand Up @@ -33,6 +34,7 @@ <h2 class="sodar-pr-content-title">Login</h2>

{% autoescape off %}
{% get_login_info %}
{% get_login_page_text %}
{% endautoescape %}

<form class="form-signin" method="post" id="sodar-form-login">
Expand Down