Skip to content

Commit

Permalink
Improve error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Oct 1, 2024
1 parent 3ed5973 commit 09b4821
Show file tree
Hide file tree
Showing 16 changed files with 200 additions and 135 deletions.
2 changes: 1 addition & 1 deletion backend/donations/views/account_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def post(self, request: HttpRequest):

logger.warning("Invalid email or password: {0}".format(email))
context["email"] = email
context["errors"] = "Se pare că această combinație de email și parolă este incorectă."
context["errors"] = _("It seems that this email and password combination is incorrect.")

return render(request, self.template_name, context)

Expand Down
50 changes: 38 additions & 12 deletions backend/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-01 11:24+0300\n"
"POT-Creation-Date: 2024-10-01 13:54+0300\n"
"PO-Revision-Date: 2024-02-28 15:45+0000\n"
"Last-Translator: Tudor Amariei <[email protected]>\n"
"Language-Team: English <https://translate.commitglobal.org/projects/act4good/"
Expand Down Expand Up @@ -428,6 +428,10 @@ msgstr "Reset site password"
msgid "sign up"
msgstr "sign up"

#: donations/views/account_management.py:136
msgid "It seems that this email and password combination is incorrect."
msgstr "It seems that this email and password combination is incorrect."

#: donations/views/account_management.py:236
msgid "Welcome to redirectioneaza.ro"
msgstr "Confirm redirectioneaza.ro account"
Expand Down Expand Up @@ -654,7 +658,7 @@ msgstr "Subdomain must have between 3 and 100 characters."

#: templates/v2/account/errors/app_missing.html:6
msgid "Application not activated"
msgstr ""
msgstr "Application not activated"

#: templates/v2/account/errors/app_missing.html:9
msgid "The application is not activated for this user/organization."
Expand All @@ -667,7 +671,7 @@ msgstr "Sign In Error"

#: templates/v2/account/errors/multiple_ngos.html:6
msgid "Multiple NGOs for this CUI"
msgstr ""
msgstr "Multiple NGOs for this CUI"

#: templates/v2/account/errors/multiple_ngos.html:9
msgid ""
Expand All @@ -679,7 +683,7 @@ msgstr ""

#: templates/v2/account/errors/unknown_role.html:6
msgid "Unknown role"
msgstr ""
msgstr "Unknown role"

#: templates/v2/account/errors/unknown_role.html:9
msgid "Your current role isn't supported."
Expand All @@ -690,28 +694,50 @@ msgstr "Your current role isn't supported."
msgid "Sign In"
msgstr "Sign In"

#: templates/v2/account/snippets/third-party.html:16
#: templates/v2/account/login.html:22
msgid "Error!"
msgstr "Error!"

#: templates/v2/account/snippets/classic-login.html:10
msgid "Login with email & password"
msgstr "Login with email & password"

#: templates/v2/account/snippets/classic-login.html:14
msgid ""
"Login for organizations that don't fit the definitions in the NGO Law — "
"26/2000"
msgstr ""
"Login for organizations that don't fit the definitions in the NGO Law — "
"26/2000"

#: templates/v2/account/snippets/third-party.html:8
msgid "Login through NGO Hub"
msgstr "Login through NGO Hub"

#: templates/v2/account/snippets/third-party.html:21
#: templates/v2/account/snippets/third-party.html:13
msgid "To access your account, you need to authenticate through NGO Hub."
msgstr "To access your account, you need to authenticate through NGO Hub."

#: templates/v2/account/snippets/third-party.html:26
#: templates/v2/account/snippets/third-party.html:18
msgid ""
"Click the \"Go to account\" button and you will be redirected to the page "
"where you need to authenticate using your NGO Hub credentials. After "
"authentication, you will be redirected to your Redirecționează account."
"where you need to authenticate using your NGO Hub credentials."
msgstr ""
"Click the \"Go to account\" button and you will be redirected to the page "
"where you need to authenticate using your NGO Hub credentials. After "
"authentication, you will be redirected to your Redirecționează account."
"where you need to authenticate using your NGO Hub credentials."

#: templates/v2/account/snippets/third-party.html:32
#: templates/v2/account/snippets/third-party.html:22
msgid "After authentication, you will be redirected to your account."
msgstr "After authentication, you will be redirected to your account."

#: templates/v2/account/snippets/third-party.html:30
msgid "Go to account"
msgstr "Go to account"

#: templates/v2/account/snippets/third-party.html:36
msgid "Create an account"
msgstr "Create an account"

#: templates/v2/socialaccount/login.html:28
msgid "Redirecting to authentication..."
msgstr "Redirecting to authentication..."
Expand Down
44 changes: 35 additions & 9 deletions backend/locale/ro/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-01 11:24+0300\n"
"POT-Creation-Date: 2024-10-01 13:54+0300\n"
"PO-Revision-Date: 2024-03-07 11:27+0000\n"
"Last-Translator: Tudor Amariei <[email protected]>\n"
"Language-Team: Romanian <https://translate.commitglobal.org/projects/"
Expand Down Expand Up @@ -430,6 +430,10 @@ msgstr "Resetare parolă redirectioneaza.ro"
msgid "sign up"
msgstr "înregistrare"

#: donations/views/account_management.py:136
msgid "It seems that this email and password combination is incorrect."
msgstr "Se pare că această combinație de email și parolă este incorectă."

#: donations/views/account_management.py:236
msgid "Welcome to redirectioneaza.ro"
msgstr "Confirmare cont redirectioneaza.ro"
Expand Down Expand Up @@ -695,28 +699,50 @@ msgstr "Rolul tău actual nu este suportat."
msgid "Sign In"
msgstr "Autentificare"

#: templates/v2/account/snippets/third-party.html:16
#: templates/v2/account/login.html:22
msgid "Error!"
msgstr "Eroare!"

#: templates/v2/account/snippets/classic-login.html:10
msgid "Login with email & password"
msgstr "Autentificare cu email și parolă"

#: templates/v2/account/snippets/classic-login.html:14
msgid ""
"Login for organizations that don't fit the definitions in the NGO Law — "
"26/2000"
msgstr ""
"Autentificare pentru organizațiile care nu se potrivesc definițiilor din "
"Legea Asociațiilor și Fundațiilor — 26/2000"

#: templates/v2/account/snippets/third-party.html:8
msgid "Login through NGO Hub"
msgstr "Autentificare prin NGO Hub"

#: templates/v2/account/snippets/third-party.html:21
#: templates/v2/account/snippets/third-party.html:13
msgid "To access your account, you need to authenticate through NGO Hub."
msgstr "Pentru a accesa contul, trebuie să te autentifici prin NGO Hub."

#: templates/v2/account/snippets/third-party.html:26
#: templates/v2/account/snippets/third-party.html:18
msgid ""
"Click the \"Go to account\" button and you will be redirected to the page "
"where you need to authenticate using your NGO Hub credentials. After "
"authentication, you will be redirected to your Redirecționează account."
"where you need to authenticate using your NGO Hub credentials."
msgstr ""
"Apasă butonul „Mergi la cont” și vei fi redirecționat către pagina unde "
"trebuie să te autentifici folosind datele tale de autentificare din NGO Hub. "
"După autentificare, vei fi redirecționat către contul tău Redirecționează."
"trebuie să te autentifici folosind datele tale de autentificare din NGO Hub."

#: templates/v2/account/snippets/third-party.html:32
#: templates/v2/account/snippets/third-party.html:22
msgid "After authentication, you will be redirected to your account."
msgstr "După autentificare, vei fi redirecționat către contul tău."

#: templates/v2/account/snippets/third-party.html:30
msgid "Go to account"
msgstr "Mergi la cont"

#: templates/v2/account/snippets/third-party.html:36
msgid "Create an account"
msgstr "Creează un cont"

#: templates/v2/socialaccount/login.html:28
msgid "Redirecting to authentication..."
msgstr "Redirecționare către autentificare..."
Expand Down
6 changes: 3 additions & 3 deletions backend/redirectioneaza/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@
path("date-cont/", MyAccountDetailsView.as_view(), name="date-contul-meu"),
path(
"contul-meu/eroare/aplicatie-lipsa/",
StaticPageView.as_view(template_name="account/errors/app_missing.html"),
StaticPageView.as_view(template_name="account/errors/login/app_missing.html"),
name="error-app-missing",
),
path(
"contul-meu/eroare/sincronizare-ong/",
StaticPageView.as_view(template_name="account/errors/multiple_ngos.html"),
StaticPageView.as_view(template_name="account/errors/login/multiple_ngos.html"),
name="error-multiple-organizations",
),
path(
"contul-meu/eroare/rol-necunoscut/",
StaticPageView.as_view(template_name="account/errors/unknown_role.html"),
StaticPageView.as_view(template_name="account/errors/login/unknown_role.html"),
name="error-unknown-user-role",
),
# APIs
Expand Down
6 changes: 4 additions & 2 deletions backend/templates/v1/cont-nou.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{% extends "base.html" %}

{% block additional_headers %}
Expand All @@ -25,7 +24,10 @@
<form class="form form-horizontal" action="/cont-nou/" role="form" method="post">
{{ csrf_input }}
<fieldset>
<legend>Cont nou</legend>
<h2>
Cont nou
</h2>

<div class="form-group">
<div class="col-xs-12 col-sm-6">
<input class="form-control" type="text" name="last_name" placeholder="Nume" required />
Expand Down
11 changes: 0 additions & 11 deletions backend/templates/v2/account/errors/app_missing.html

This file was deleted.

20 changes: 10 additions & 10 deletions backend/templates/v2/account/errors/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
{% load static %}
{% load i18n %}

{% block content %}
<div class="container">

{% block title %}{% trans 'Sign In Error' %}{% endblock %}
<h1>
{% block title %}{% endblock %}
</h1>
<p>
{% block message %}{% endblock %}
</p>

{% block left-side-view %}
<div class="container tight-container content mb-50">
<h2>
{% trans 'Sign In Error' %}
</h2>
{% block extra_content %}{% endblock %}

{% block error_message %}
<p></p>
{% endblock %}
</div>
</div>
{% endblock %}
10 changes: 10 additions & 0 deletions backend/templates/v2/account/errors/login/app_missing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends 'account/errors/login/base_login.html' %}
{% load i18n %}

{% block title %}
{% trans 'Application not activated' %}
{% endblock %}

{% block message %}
{% trans 'The application is not activated for this user/organization.' %}
{% endblock %}
8 changes: 8 additions & 0 deletions backend/templates/v2/account/errors/login/base_login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends 'account/errors/base.html' %}
{% load i18n %}

{% block extra_content %}
<p>
<a href="{% url 'login' %}" class="btn btn-primary">{% trans "Return to login" %}</a>
</p>
{% endblock %}
10 changes: 10 additions & 0 deletions backend/templates/v2/account/errors/login/multiple_ngos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends 'account/errors/login/base_login.html' %}
{% load i18n %}

{% block title %}
{% trans 'Multiple NGOs for this CUI' %}
{% endblock %}

{% block message %}
{% trans 'Multiple NGOs have been found during synchronization. Admins have been notified and will resolve the issue shortly.' %}
{% endblock %}
10 changes: 10 additions & 0 deletions backend/templates/v2/account/errors/login/unknown_role.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends 'account/errors/login/base_login.html' %}
{% load i18n %}

{% block title %}
{% trans 'Unknown role' %}
{% endblock %}

{% block message %}
{% trans "Your current role isn't supported." %}
{% endblock %}
11 changes: 0 additions & 11 deletions backend/templates/v2/account/errors/multiple_ngos.html

This file was deleted.

11 changes: 0 additions & 11 deletions backend/templates/v2/account/errors/unknown_role.html

This file was deleted.

34 changes: 25 additions & 9 deletions backend/templates/v2/account/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,34 @@
{% endelement %}

<div id="login-container" class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-1" id="login">
<div class="col-xs-12 col-sm-8 col-sm-offset-1" id="login">

{% if not SOCIALACCOUNT_ONLY %}
{% include "account/snippets/classic-login.html" %}
{% endif %}
<div class="row">
{% if errors %}
<div class="col-xs-12 col-md-6 col-md-offset-3">
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>
{% trans "Error!" %}
</strong>
{{ errors }}
</div>
</div>
{% endif %}
</div>

{% if SOCIALACCOUNT_ONLY or SOCIALACCOUNT_ENABLED %}
{% include "account/snippets/third-party.html" %}
{% endif %}
{% if SOCIALACCOUNT_ONLY or SOCIALACCOUNT_ENABLED %}
{% include "account/snippets/third-party.html" %}
{% endif %}

<div class="g-recaptcha" data-sitekey="{{ captcha_public_key }}" data-size="invisible" data-callback="onSubmit"></div>
</div>
{% if not SOCIALACCOUNT_ONLY %}
<hr>

{% include "account/snippets/classic-login.html" %}
{% endif %}

<div class="g-recaptcha" data-sitekey="{{ captcha_public_key }}" data-size="invisible" data-callback="onSubmit"></div>
</div>
</div>

{% endblock content %}
Loading

0 comments on commit 09b4821

Please sign in to comment.