From 007a712500b30d819ab6201eff4cd7ad1be5898a Mon Sep 17 00:00:00 2001 From: Hu Gang <18768366022@163.com> Date: Tue, 19 Nov 2024 10:17:52 +0800 Subject: [PATCH] add form validation --- 0005-change-login-authorization-url.patch | 53 ++++++ ...-validation-when-submitting-the-form.patch | 157 ++++++++++++++++++ 0007-update-authhub-yml.patch | 32 ++++ authHub.spec | 10 +- 4 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 0005-change-login-authorization-url.patch create mode 100644 0006-add-field-validation-when-submitting-the-form.patch create mode 100644 0007-update-authhub-yml.patch diff --git a/0005-change-login-authorization-url.patch b/0005-change-login-authorization-url.patch new file mode 100644 index 0000000..e2ec394 --- /dev/null +++ b/0005-change-login-authorization-url.patch @@ -0,0 +1,53 @@ +From 0db4bdfcc43a32948f53c4599e0f7dc74f1d7fee Mon Sep 17 00:00:00 2001 +From: hugang <18768366022@163.com> +Date: Sat, 26 Oct 2024 14:59:28 +0800 +Subject: [PATCH] change login authorization url + +--- + oauth2_provider/app/views/oauth2.py | 2 +- + oauth2_web/.gitignore | 4 +++- + oauth2_web/src/views/Login.vue | 4 +++- + 3 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/oauth2_provider/app/views/oauth2.py b/oauth2_provider/app/views/oauth2.py +index 8e7bb98..ec44a13 100644 +--- a/oauth2_provider/app/views/oauth2.py ++++ b/oauth2_provider/app/views/oauth2.py +@@ -129,7 +129,7 @@ class OauthorizeView(BaseResponse, OAuth2): + redirect_url = ( + (request.args.get('redirect_to_url') or self.login_uri) + + "?authorization_uri=" +- + quote(auth_request.uri) ++ + quote(request.full_path) + ) + if not self._validate_token(request.cookies.get('Authorization')): + raise InvalidTokenError("Invalid token") +diff --git a/oauth2_web/.gitignore b/oauth2_web/.gitignore +index e83bf3e..5493dd1 100644 +--- a/oauth2_web/.gitignore ++++ b/oauth2_web/.gitignore +@@ -1,2 +1,4 @@ + pnpm-lock.yaml +-node_modules +\ No newline at end of file ++node_modules ++ ++dist +diff --git a/oauth2_web/src/views/Login.vue b/oauth2_web/src/views/Login.vue +index 7e88371..42e7a51 100644 +--- a/oauth2_web/src/views/Login.vue ++++ b/oauth2_web/src/views/Login.vue +@@ -80,7 +80,9 @@ async function login() { + } else { + const [_, res] = await api.login(form) + if (res) { +- window.location.href = authorizationUri as any ++ const url = new URL(window.location.href) ++ const authUrl = `${url.origin}${authorizationUri}` ++ window.location.href = authUrl + } + } + isSubmiting.value = false +-- +2.33.0 + diff --git a/0006-add-field-validation-when-submitting-the-form.patch b/0006-add-field-validation-when-submitting-the-form.patch new file mode 100644 index 0000000..bc9636d --- /dev/null +++ b/0006-add-field-validation-when-submitting-the-form.patch @@ -0,0 +1,157 @@ +From a3871e75d3d098c7204cd29f35d21845c206465c Mon Sep 17 00:00:00 2001 +From: Hu Gang <18768366022@163.com> +Date: Thu, 14 Nov 2024 19:46:11 +0800 +Subject: [PATCH] Add field validation when submitting the form + +--- + oauth2_web/src/views/ApplicationConf.vue | 51 ++++++++++++++++++++++-- + oauth2_web/src/views/NewApplication.vue | 39 ++++++++++++------ + 2 files changed, 75 insertions(+), 15 deletions(-) + +diff --git a/oauth2_web/src/views/ApplicationConf.vue b/oauth2_web/src/views/ApplicationConf.vue +index cf87919..c7377f2 100644 +--- a/oauth2_web/src/views/ApplicationConf.vue ++++ b/oauth2_web/src/views/ApplicationConf.vue +@@ -41,11 +41,55 @@ const originForm = reactive