diff --git a/README.md b/README.md index 9993c655..14dae991 100644 --- a/README.md +++ b/README.md @@ -110,4 +110,8 @@ vim /etc/resolv.conf ``` nameserver 172.21.176.1 ``` -- Access the localhost using this IP (e.g.: 172.21.176.1:8000) \ No newline at end of file +- Access the localhost using this IP (e.g.: 172.21.176.1:8000) + +### Prototype + +The Jandig platform count with a High-Fidelity Prototype which aims the development and documentation of improvements related to usability. To acess and contribute with the prototype, follow the instructions in [Prototype Documentation](/docs/prototype.md). \ No newline at end of file diff --git a/docs/images/figma-home.png b/docs/images/figma-home.png new file mode 100644 index 00000000..3165f4fb Binary files /dev/null and b/docs/images/figma-home.png differ diff --git a/docs/images/figma-login.png b/docs/images/figma-login.png new file mode 100644 index 00000000..52add0dc Binary files /dev/null and b/docs/images/figma-login.png differ diff --git a/docs/images/figma-save-local.PNG b/docs/images/figma-save-local.PNG new file mode 100644 index 00000000..4a6d791d Binary files /dev/null and b/docs/images/figma-save-local.PNG differ diff --git a/docs/images/figma-upload-file.png b/docs/images/figma-upload-file.png new file mode 100644 index 00000000..183278be Binary files /dev/null and b/docs/images/figma-upload-file.png differ diff --git a/docs/images/open-prototype.png b/docs/images/open-prototype.png new file mode 100644 index 00000000..c01bbd4e Binary files /dev/null and b/docs/images/open-prototype.png differ diff --git a/docs/images/project-figma.PNG b/docs/images/project-figma.PNG new file mode 100644 index 00000000..927a5fa5 Binary files /dev/null and b/docs/images/project-figma.PNG differ diff --git a/docs/images/prototype-file-downhold.png b/docs/images/prototype-file-downhold.png new file mode 100644 index 00000000..f2bb9e61 Binary files /dev/null and b/docs/images/prototype-file-downhold.png differ diff --git a/docs/images/save-file.PNG b/docs/images/save-file.PNG new file mode 100644 index 00000000..e02b4f02 Binary files /dev/null and b/docs/images/save-file.PNG differ diff --git a/docs/prototype.md b/docs/prototype.md new file mode 100644 index 00000000..1547bffc --- /dev/null +++ b/docs/prototype.md @@ -0,0 +1,44 @@ +# Prototype +The Jandig platform prototype is a graphical representation of the platform developed using Figma [Figma](https://www.figma.com/downloads/) tool, it has the purpose of improving Jandig ARte platform's interface and user experience aspects. Thus, the High Fidelity Prototype is a representation of the platforms containing general usability improvements, used to arise activities to implement the suggested modifications. + + +## Accessing the Prototype +The prototype must be accessed using Figma platform, follow the steps below to access the prototype: + +1 - Login or Register on [Figma](https://www.figma.com/login) platform; + +![figma-login](./images/figma-save-local.PNG) + +2 - Download the [prototype file](https://github.com/memeLab/Jandig/blob/develop/docs/jandig_prototype.fig) to your computer; + +![prototype-file-downhold](./images/prototype-file-downhold.png) + +3 - Select the "import file" option on figma's main screen and select the previously downloaded file; + +![figma-home](./images/figma-home.png) + +![figma-upload-file](./images/figma-upload-file.png) + +5 - Access the prototype by clicking on the project. + +![open-prototype](./images/open-prototype.png) + + +## Contributing to the Prototype + +1 - Access the prototype using Figma platform as written in the tutorial described in the previous section; + +2 - Open an Issue describing changes to be made to the prototype or select an existing issue and contribute to the issue. In order to do this follow the [contribution guide](https://github.com/memeLab/ARte/blob/master/.github/CONTRIBUTING.md); + +3 - After making changes to the prototype following the guidelines of the chosen or created issue, upload the file following the steps below: + +- 1 - Download the new version of the prototype onto your computer using your [Figma](https://www.figma.com/login); + + ![project-figma](./images/project-figma.PNG) + + ![figma-save-local](./images/figma-save-local.PNG) + + ![save-file](./images/save-file.PNG) + +- 2 - Upload the file "jadig_prototype.fig" replacing the existing file with the updated version. + diff --git a/poetry.lock b/poetry.lock index 6c018128..fcf3024f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,17 +74,17 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "boto3" -version = "1.35.51" +version = "1.35.56" description = "The AWS SDK for Python" optional = false python-versions = ">=3.8" files = [ - {file = "boto3-1.35.51-py3-none-any.whl", hash = "sha256:c922f6a18958af9d8af0489d6d8503b517029d8159b26aa4859a8294561c72e9"}, - {file = "boto3-1.35.51.tar.gz", hash = "sha256:a57c6c7012ecb40c43e565a6f7a891f39efa990ff933eab63cd456f7501c2731"}, + {file = "boto3-1.35.56-py3-none-any.whl", hash = "sha256:d04608cf40f429025eb66b52b835bdc333436022918788853ed0bbbba6dd2f09"}, + {file = "boto3-1.35.56.tar.gz", hash = "sha256:6fcc510a4e747e85f84046b0ba0e5b178e89ba0f8ac9e2b6ebb4cc925c68c23b"}, ] [package.dependencies] -botocore = ">=1.35.51,<1.36.0" +botocore = ">=1.35.56,<1.36.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.10.0,<0.11.0" @@ -93,13 +93,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.51" +version = "1.35.56" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.35.51-py3-none-any.whl", hash = "sha256:4d65b00111bd12b98e9f920ecab602cf619cc6a6d0be6e5dd53f517e4b92901c"}, - {file = "botocore-1.35.51.tar.gz", hash = "sha256:a9b3d1da76b3e896ad74605c01d88f596324a3337393d4bfbfa0d6c35822ca9c"}, + {file = "botocore-1.35.56-py3-none-any.whl", hash = "sha256:4be97f7bc1fbf33ad71ee1b678cea0ecf9638e61d5f566a46f261cde969dd690"}, + {file = "botocore-1.35.56.tar.gz", hash = "sha256:8a9e752c8e87a423575ac528340a35d4318b8576ae4c6e0acfe5a3867f6bbccf"}, ] [package.dependencies] @@ -356,13 +356,13 @@ six = ">=1.10" [[package]] name = "django" -version = "5.1.2" +version = "5.1.3" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.10" files = [ - {file = "Django-5.1.2-py3-none-any.whl", hash = "sha256:f11aa87ad8d5617171e3f77e1d5d16f004b79a2cf5d2e1d2b97a6a1f8e9ba5ed"}, - {file = "Django-5.1.2.tar.gz", hash = "sha256:bd7376f90c99f96b643722eee676498706c9fd7dc759f55ebfaf2c08ebcdf4f0"}, + {file = "Django-5.1.3-py3-none-any.whl", hash = "sha256:8b38a9a12da3ae00cb0ba72da985ec4b14de6345046b1e174b1fd7254398f818"}, + {file = "Django-5.1.3.tar.gz", hash = "sha256:c0fa0e619c39325a169208caef234f90baa925227032ad3f44842ba14d75234a"}, ] [package.dependencies] @@ -545,13 +545,13 @@ doc = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-spelling"] [[package]] name = "faker" -version = "30.8.1" +version = "30.8.2" description = "Faker is a Python package that generates fake data for you." optional = false python-versions = ">=3.8" files = [ - {file = "Faker-30.8.1-py3-none-any.whl", hash = "sha256:4f7f133560b9d4d2a915581f4ba86f9a6a83421b89e911f36c4c96cff58135a5"}, - {file = "faker-30.8.1.tar.gz", hash = "sha256:93e8b70813f76d05d98951154681180cb795cfbcff3eced7680d963bcc0da2a9"}, + {file = "Faker-30.8.2-py3-none-any.whl", hash = "sha256:4a82b2908cd19f3bba1a4da2060cc4eb18a40410ccdf9350d071d79dc92fe3ce"}, + {file = "faker-30.8.2.tar.gz", hash = "sha256:aa31b52cdae3673d6a78b4857c7bcdc0e98f201a5cb77d7827fa9e6b5876da94"}, ] [package.dependencies] @@ -938,13 +938,13 @@ files = [ [[package]] name = "packaging" -version = "24.1" +version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] @@ -1420,13 +1420,13 @@ crt = ["botocore[crt] (>=1.33.2,<2.0a.0)"] [[package]] name = "sentry-sdk" -version = "2.17.0" +version = "2.18.0" description = "Python client for Sentry (https://sentry.io)" optional = false python-versions = ">=3.6" files = [ - {file = "sentry_sdk-2.17.0-py2.py3-none-any.whl", hash = "sha256:625955884b862cc58748920f9e21efdfb8e0d4f98cca4ab0d3918576d5b606ad"}, - {file = "sentry_sdk-2.17.0.tar.gz", hash = "sha256:dd0a05352b78ffeacced73a94e86f38b32e2eae15fff5f30ca5abb568a72eacf"}, + {file = "sentry_sdk-2.18.0-py2.py3-none-any.whl", hash = "sha256:ee70e27d1bbe4cd52a38e1bd28a5fadb9b17bc29d91b5f2b97ae29c0a7610442"}, + {file = "sentry_sdk-2.18.0.tar.gz", hash = "sha256:0dc21febd1ab35c648391c664df96f5f79fb0d92d7d4225cd9832e53a617cafd"}, ] [package.dependencies] @@ -1454,9 +1454,11 @@ httpx = ["httpx (>=0.16.0)"] huey = ["huey (>=2)"] huggingface-hub = ["huggingface-hub (>=0.22)"] langchain = ["langchain (>=0.0.210)"] +launchdarkly = ["launchdarkly-server-sdk (>=9.8.0)"] litestar = ["litestar (>=2.0.0)"] loguru = ["loguru (>=0.5)"] openai = ["openai (>=1.0.0)", "tiktoken (>=0.3.0)"] +openfeature = ["openfeature-sdk (>=0.7.1)"] opentelemetry = ["opentelemetry-distro (>=0.35b0)"] opentelemetry-experimental = ["opentelemetry-distro"] pure-eval = ["asttokens", "executing", "pure-eval"] diff --git a/src/users/forms.py b/src/users/forms.py index 1be84fae..172bfee1 100644 --- a/src/users/forms.py +++ b/src/users/forms.py @@ -143,45 +143,32 @@ def __init__(self, *args, **kwargs): self.fields["username"].widget.attrs["placeholder"] = _("username / email") self.fields["password"].widget.attrs["placeholder"] = _("password") - def clean_username(self): - username_or_email = self.cleaned_data.get("username") + def clean(self): + cleaned_data = super(LoginForm, self).clean() + + username_or_email = cleaned_data.get("username", "") + search_by = {} + if "@" in username_or_email: - if not User.objects.filter(email=username_or_email).exists(): - raise forms.ValidationError(_("Username/email not found")) - user = User.objects.get(email=username_or_email) - if user: - return user.username + search_by["email"] = username_or_email else: - if not User.objects.filter(username=username_or_email).exists(): - raise forms.ValidationError(_("Username/email not found")) + search_by["username"] = username_or_email - # Already is a valid username - return username_or_email + user = User.objects.get(**search_by) + if not user: + raise forms.ValidationError(_("Username/email not found")) - def clean_password(self): - password = self.cleaned_data.get("password") - username_or_email = self.cleaned_data.get("username") - user = None - username_or_email_wrong = False + cleaned_data["username"] = user.username - if "@" in username_or_email: - if User.objects.filter(email=username_or_email).exists(): - username = User.objects.get(email=username_or_email).username - user = authenticate(username=username, password=password) - else: - username_or_email_wrong = True - # raise forms.ValidationError(_('Email Wrong!')) - else: - if User.objects.filter(username=username_or_email).exists(): - user = authenticate(username=username_or_email, password=password) - else: - username_or_email_wrong = True - # raise forms.ValidationError(_('Username Wrong!')) + password = cleaned_data.get("password") - if not user and not username_or_email_wrong: + logged_user = authenticate(username=user.username, password=password) + if not logged_user: raise forms.ValidationError(_("Wrong password!")) - return password + self.confirm_login_allowed(logged_user) + + return cleaned_data class RecoverPasswordForm(forms.Form): diff --git a/src/users/jinja2/users/login.jinja2 b/src/users/jinja2/users/login.jinja2 index 4eb8e754..2b720ba0 100644 --- a/src/users/jinja2/users/login.jinja2 +++ b/src/users/jinja2/users/login.jinja2 @@ -27,8 +27,14 @@
{{ field }}
-