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

Strip leading and trailing spaces from username during login #5093

Closed
wants to merge 88 commits into from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 4, 2023

Description

This PR addresses the issue #5056 by modifying the login route in gradio/routes.py to strip leading and trailing spaces from the username during the login process. This change ensures that unintentional spaces in the username do not cause errors.

Summary of Changes

  • Modified the login function in gradio/routes.py to strip leading and trailing spaces from the username retrieved from the form data.
  • Changed the line username, password = form_data.username, form_data.password to username, password = form_data.username.strip(), form_data.password.

This change is minimal and does not affect other parts of the codebase. It improves the user experience by preventing errors caused by unintentional spaces in the username.

Fixes #5056.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/strip-username-spaces

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

pngwn and others added 30 commits July 12, 2023 11:44
* Fix api_name=False

* Add more to test
* Use tempdir for all tests

* Disable telemetry automaticall for client

* Use configuration

* Push js

* Final comments

* Undo change
* move chromatic to push event and change message

* output test

* test

* tweak

* get PR for push event

* changes

* omit forks and check label using gh action

* tweak

* workflow tweaks

* test tweak

* remove test output

* add pending comment

* tweak message

* newline

* only run chromatic workflow if pushed files are in js folder

* test

* remove test

* update workflow path filter with theme files

Co-authored-by: pngwn <hello@pngwn.io>

* add chromatic workflow to path filter

---------

Co-authored-by: pngwn <hello@pngwn.io>
* requirements

* pins

* clogs

* python multipart

* python multipart

* clogs

* clog
* Debug

* Upload screenshots

* Fix path

* turn on verbose mode

* turn on verbose mode

* turn on verbose mode

* await click

* cleanup

* trigger ci

---------

Co-authored-by: pngwn <hello@pngwn.io>
* Support urls

* Add unit test

* CHANGELOG

* Bump client version

* use url_like
* add group

* exclude js/_website from workflow and add echo pr test

* fix path / remove echo

---------

Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* changes

* changes

* changes

* Revert "changes"

This reverts commit cbebf39.

* lint

* fix tests

* an

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* helpers

* helpers

* async and tests

* docstring

* changelog

* type

* typing

* helpers
* fix the expired image link

* update CHANGELOG.md

* Update gradio/themes/app.py

change the image link same as the original one

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update gradio/themes/app.py

change the image link same as the original one

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* apply lint

* equalize the default image link with app.py

* equalize default image links in building theme

* equalize default image links in demo notebook

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* apply missing flex to Row component

* remove redundant !important

* changelog

* add (sort of a) row test

* remove import
* add rtl support

* redo

* remove param

* clog

* fix backend tests; add textbox story

* add textbox story

* fix textbox story

* fixed textbox story, markdown

* markdown story

* format

* fixes'

* Update CHANGELOG.md

* update docstrings

* fix tests

* fix static checks

* fix tests
…4937)

* Queue max_size defaults to Block's max_threads on ZeroGPU Spaces

* More readable ?

* CHANGELOG
* changes

* changes

* changes

* changes

* changes

* fix

* changes

* changes

* Deploy group demo

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
* Add code

* CHANGELOG

* Add code

* Use set

* Modify _setup_serializers instead

* Push up code

* Remove from serializing

* Add gradio_client changes

* Update requirements.txt
* push

* chat interface

* remove video artifact

* changes

* restore

* changes

* more functions

* clean

* chat interface

* chat interface

* Update gradio/chat_interface.py

* nit

* changes

* api fix

* chat interface

* guide

* guide

* changes

* fixes

* Added ChatInterface Examples for Langchain, OpenAI Streaming, and HF's Text Generation Inference (StarChat)

* docstring

* tests

* tests

* tests

* tests

* rename

* guide

* chatbot

* conclusion

* demo notebooks

* clog

* test

* chat interface

* fixes

* functional test

* test

* notebook

* guides

* typing

* docstring

* script

* upgrade pyright

* upgrade pyright

* Update CHANGELOG.md

* revert pyright upgrade

* typing

* redirects

* Update CHANGELOG.md

* guide

* guide

* readme

* screenshot

* add to readme

* quickstart

* readme

* Added transformers open-source LLM example using ChatInterface

* Minor nits to guide

* Minor tweak to test - use connect fixture

* website fixes

* nav

* guide

* fix tests'

* fix

* type

* clear

* chat interface

* fix test

* fix guide

* handle edge case

* edge case

* typing

* fix example caching with streaming

* typing

---------

Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: Yuvraj Sharma <48665385+yvrjsharma@users.noreply.github.com>
Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
* version

* ltr
* apply pyright components

* Add code

* CHANGELOG

* format

* Add configuration

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* fix right nav bar docs

* make guides responsive

* make changelog responsive

* much better side navbar
hannahblair and others added 17 commits July 31, 2023 16:54
#5046)

* allow new lines in highlighted text with /n

* add changeset

* preserve white spaces in text

* add changeset

* add changeset

* add highlighted text stories

* add changeset

* fix broken story

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* add download button to gallery selected images

* add changeset

* add story

* tweak

* fix href val for internal file paths

* set show_download_button to True by default

* lint backend

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* add step param to number component

* add changeset

* fix test

* fix BE test

* fix test again

* update number.py

* fix test

* test fix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
…5035)

* In transform_output, typeof d can be an object even if the property is_file doesn't exist on d. Therefore invoking d.is_file will error out. This commit fixes that by failing quietly if the is_file property doesn't exist on d.

* Update client.ts - fixed spacing

fixed spacing

* add changeset

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* fix(pkg_resources): use `importlib` in favor of `pkg_resources`

* lint

* import

* removed unnecessary version check

* fixes

* pass lint and format

* fix

* requirements

* fix all typing issues

* fix routes

* fix

* Delete forty-rooms-arrive.md

* add changeset

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* Add code

* Dont format on save

* Delete prettier line
* Add focus event to textbox and number component

* add changeset

* Combine Blurrable and Focusable into Focusable event

* Add focus and blur to Dropdown and Colorpicker components

* add focus to home page template

* Add Focus to doc

* Fix linting error

* fixes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
… an option is selected (#5062)

* dropdown fixes

* add changeset

* add changeset

* guide

* guide

* stories

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
…5061)

* fix to client

* add changeset

* lint

* add changeset

* add changeset

* add changeset

* add changeset

* pin

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* Add deploy_discord to docs

* add changeset

* add jsons

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
…5075)

* allow supporting >1000 files

* add changeset

* Update client/js/src/client.ts

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* solve how can I config root_path dynamically? #4968

* add changeset

* fixes

* fixes

* fix

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* asd

* changes

* fix everything

* cleanup

* add changeset

* fix casing

* lockfile

* fix casing

* fix ci, enable linting

* fix test

* add changeset

* add changeset

* delete changeset

* fix dirs

* fix casing

* fix notebooks

* fix casing

* fix casing

* fix casing

* fix casing

* fix casing

* fix casing

* fix casing

* fix casing

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* chore(deps): update dependency extendable-media-recorder to v8

* add changeset

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
…#5045)

* Fix the analytics module to use asyncio to work in the Wasm env

* add changeset

* add changeset

* Add changeset

* Revert "Add changeset"

This reverts commit 052f2bd.

* Add the `is_wasm` field to the analytics telemetry

* Restore the initialization code in Blocks.launch() in the Wasm env

* Remove a call of analytics.version_check() in Blocks.launch() in the Wasm mode

* Add a `type: ignore` directive to the line of importing the `pyodide` module

* Fix a test case

* Refactor _do_wasm_analytics_request() and add a unit test for it

* Get the IP address for analytics in the Wasm mode

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
@vercel
Copy link

vercel bot commented Aug 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
gradio ✅ Ready (Inspect) Visit Preview Aug 4, 2023 3:32pm

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 4, 2023

GitHub actions yielded the following error.

The command that failed is:

cat CHANGELOG.md client/python/CHANGELOG.md | grep -w "https://github.com/gradio-app/gradio/pull/5093"

Here are the relevant lines from the logs:

##[group]Run cat CHANGELOG.md client/python/CHANGELOG.md | grep -w "https://github.com/gradio-app/gradio/pull/5093"
�[36;1mcat CHANGELOG.md client/python/CHANGELOG.md | grep -w "https://github.com/gradio-app/gradio/pull/5093"�[0m
shell: /usr/bin/bash -e {0}
##[endgroup]
##[error]Process completed with exit code 1.

This is likely a linting or type-checking issue with the source code.

@abidlabs
Copy link
Member

abidlabs commented Aug 4, 2023

Thanks Sweep. This change looks good. Can you also add a test in test_post_login?

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Aug 4, 2023

🎉 Chromatic build completed!

There are 0 visual changes to review.
There are 0 failed tests to fix.

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Aug 4, 2023

🎉 The demo notebooks match the run.py files! 🎉

@abidlabs
Copy link
Member

abidlabs commented Aug 4, 2023

What just happened Sweep? Now there are so many unnecessary files in this PR

@abidlabs abidlabs closed this Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.