Merge pull request #2266 from SchrodingersGat/login-tweaks

Login tweaks
This commit is contained in:
Oliver 2021-11-08 10:19:23 +11:00 committed by GitHub
commit a12baadc09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 24 deletions

View File

@ -34,8 +34,7 @@
}
.login-header {
padding-right: 30px;
margin-right: 30px;
margin-right: 5px;
}
.login-container input {

View File

@ -22,12 +22,12 @@
<a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a>{% include "clip.html" %}
{% inventree_is_development as dev %}
{% if dev %}
<span class='badge rounded-pill bg-primary'>{% trans "Development Version" %}</span>
<span class='badge badge-right rounded-pill bg-primary'>{% trans "Development Version" %}</span>
{% else %}
{% if up_to_date %}
<span class='badge rounded-pill bg-success'>{% trans "Up to Date" %}</span>
<span class='badge badge-right rounded-pill bg-success'>{% trans "Up to Date" %}</span>
{% else %}
<span class='badge rounded-pill bg-info'>{% trans "Update Available" %}</span>
<span class='badge badge-right rounded-pill bg-info'>{% trans "Update Available" %}</span>
{% endif %}
{% endif %}
</td>

View File

@ -71,8 +71,11 @@
{% include "spacer.html" %}
<span class='float-right'><h3>{% inventree_title %}</h3></span>
</div>
</div>
<div class='container-fluid'>
<hr>
<div class='container-fluid'>{% block content %}{% endblock %}</div>
{% block content %}
{% endblock %}
</div>
</div>
</div>

View File

@ -32,6 +32,7 @@ for a account and sign in below:{% endblocktrans %}</p>
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<hr>
<div class="btn-group float-right" role="group">
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button>
</div>

View File

@ -14,6 +14,7 @@
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<hr>
<div class='btn-group float-right' role='group'>
<a type='button' class='btn btn-secondary' href='{% url "index" %}'><span class='fas fa-undo-alt'></span> {% trans "Back to Site" %}</a>
<button type="submit" class="btn btn-danger btn-block">{% trans 'Sign Out' %}</button>

View File

@ -190,6 +190,18 @@ $(document).ready(function () {
{% endif %}
moment.locale('{{ request.LANGUAGE_CODE }}');
// Account notifications
{% if messages %}
{% for message in messages %}
showMessage(
'{{ message }}',
{
style: 'info',
}
);
{% endfor %}
{% endif %}
});
</script>

View File

@ -19,7 +19,6 @@
renderStockLocation,
renderSupplierPart,
renderUser,
showAlertDialog,
showAlertOrCache,
showApiError,
*/
@ -347,10 +346,12 @@ function constructForm(url, options) {
constructCreateForm(OPTIONS.actions.POST, options);
} else {
// User does not have permission to POST to the endpoint
showAlertDialog(
'{% trans "Action Prohibited" %}',
'{% trans "Create operation not allowed" %}'
);
showMessage('{% trans "Action Prohibited" %}', {
style: 'danger',
details: '{% trans "Create operation not allowed" %}',
icon: 'fas fa-user-times',
});
console.log(`'POST action unavailable at ${url}`);
}
break;
@ -360,10 +361,12 @@ function constructForm(url, options) {
constructChangeForm(OPTIONS.actions.PUT, options);
} else {
// User does not have permission to PUT/PATCH to the endpoint
showAlertDialog(
'{% trans "Action Prohibited" %}',
'{% trans "Update operation not allowed" %}'
);
showMessage('{% trans "Action Prohibited" %}', {
style: 'danger',
details: '{% trans "Update operation not allowed" %}',
icon: 'fas fa-user-times',
});
console.log(`${options.method} action unavailable at ${url}`);
}
break;
@ -372,10 +375,12 @@ function constructForm(url, options) {
constructDeleteForm(OPTIONS.actions.DELETE, options);
} else {
// User does not have permission to DELETE to the endpoint
showAlertDialog(
'{% trans "Action Prohibited" %}',
'{% trans "Delete operation not allowed" %}'
);
showMessage('{% trans "Action Prohibited" %}', {
style: 'danger',
details: '{% trans "Delete operation not allowed" %}',
icon: 'fas fa-user-times',
});
console.log(`DELETE action unavailable at ${url}`);
}
break;
@ -384,10 +389,12 @@ function constructForm(url, options) {
// TODO?
} else {
// User does not have permission to GET to the endpoint
showAlertDialog(
'{% trans "Action Prohibited" %}',
'{% trans "View operation not allowed" %}'
);
showMessage('{% trans "Action Prohibited" %}', {
style: 'danger',
details: '{% trans "View operation not allowed" %}',
icon: 'fas fa-user-times',
});
console.log(`GET action unavailable at ${url}`);
}
break;