Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add terms checkbox in owner signup page (#1289)
STEVENe127619ba975
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 9c94cf6227..4b8a916af0 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -647,7 +647,10 @@"confirm-password": "Confirm Password","confirm-password-placeholder": "Confirm password","password-mismatch": "mismatch",- "existing-user": "Already have an account?"+ "existing-user": "Already have an account?",+ "accept-terms-and-policy": "I accept Bytebase's {terms} and {policy}",+ "terms-of-service": "Terms of Service",+ "privacy-policy": "Privacy Policy"},"sign-in": {"title": "Sign in to your account",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 34eae1143d..e654dfb6dc 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -647,7 +647,10 @@"confirm-password": "确认密码","confirm-password-placeholder": "确认您的密码","password-mismatch": "不匹配",- "existing-user": "已有账号?"+ "existing-user": "已有账号?",+ "accept-terms-and-policy": "我接受 Bytebase 的{terms}和{policy}",+ "terms-of-service": "服务条款",+ "privacy-policy": "隐私政策"},"sign-in": {"title": "登录您的账号",diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vueindex 59face0071..b1a023703b 100644--- a/frontend/src/views/auth/Signup.vue+++ b/frontend/src/views/auth/Signup.vue@@ -54,12 +54,12 @@<div class="mt-1 rounded-md shadow-sm"><inputid="password"+ v-model="state.password"type="password"autocomplete="off"- :value="state.password"requiredclass="appearance-none block w-full px-3 py-2 border border-control-border rounded-md placeholder-control-placeholder focus:outline-none focus:shadow-outline-blue focus:border-control-border sm:text-sm sm:leading-5"- @input="changePassword($event.target.value)"+ @input="refreshPasswordValidation"/></div></div>@@ -82,13 +82,13 @@<div class="mt-1 rounded-md shadow-sm"><inputid="password-confirm"+ v-model="state.passwordConfirm"type="password"autocomplete="off":placeholder="$t('auth.sign-up.confirm-password-placeholder')"- :value="state.passwordConfirm"requiredclass="appearance-none block w-full px-3 py-2 border border-control-border rounded-md placeholder-control-placeholder focus:outline-none focus:shadow-outline-blue focus:border-control-border sm:text-sm sm:leading-5"- @input="changePasswordConfirm($event.target.value)"+ @input="refreshPasswordValidation"/></div></div>@@ -112,6 +112,36 @@</div></div>+ <div+ v-if="needAdminSetup"+ class="w-full flex flex-row justify-start items-start"+ >+ <BBCheckbox+ :value="state.acceptTermsAndPolicy"+ class="mt-0.5"+ @toggle="onToggleAcceptTermsAndPolicyCheckbox"+ />+ <i18n-t+ tag="span"+ keypath="auth.sign-up.accept-terms-and-policy"+ class="ml-1 select-none"+ @click="onToggleAcceptTermsAndPolicyCheckbox"+ >+ <template #terms>+ <a href="https://www.bytebase.com/terms" class="text-accent">{{+ $t("auth.sign-up.terms-of-service")+ }}</a>+ </template>+ <template #policy>+ <a+ href="https://www.bytebase.com/privacy"+ class="text-accent"+ >{{ $t("auth.sign-up.privacy-policy") }}</a+ >+ </template>+ </i18n-t>+ </div>+<div><span class="block w-full rounded-md shadow-sm"><button@@ -150,13 +180,19 @@</template><script lang="ts">-import { computed, defineComponent, onUnmounted, reactive } from "vue";+import {+ computed,+ defineComponent,+ onMounted,+ onUnmounted,+ reactive,+} from "vue";import { useRouter } from "vue-router";-import { SignupInfo, TEXT_VALIDATION_DELAY } from "../../types";-import { isValidEmail } from "../../utils";-import AuthFooter from "./AuthFooter.vue";-import { useActuatorStore, useAuthStore } from "@/store";import { storeToRefs } from "pinia";+import { useActuatorStore, useAuthStore } from "@/store";+import { SignupInfo, TEXT_VALIDATION_DELAY } from "@/types";+import { isValidEmail } from "@/utils";+import AuthFooter from "./AuthFooter.vue";interface LocalState {email: string;@@ -166,6 +202,7 @@ interface LocalState {showPasswordMismatchError: boolean;name: string;nameManuallyEdited: boolean;+ acceptTermsAndPolicy: boolean;}export default defineComponent({@@ -182,6 +219,7 @@ export default defineComponent({showPasswordMismatchError: false,name: "",nameManuallyEdited: false,+ acceptTermsAndPolicy: true,});onUnmounted(() => {@@ -196,7 +234,8 @@ export default defineComponent({return (isValidEmail(state.email) &&state.password &&- !state.showPasswordMismatchError+ !state.showPasswordMismatchError &&+ state.acceptTermsAndPolicy);});@@ -204,6 +243,12 @@ export default defineComponent({return state.password == state.passwordConfirm;});+ onMounted(() => {+ if (needAdminSetup.value) {+ state.acceptTermsAndPolicy = false;+ }+ });+const refreshPasswordValidation = () => {if (state.passwordValidationTimer) {clearInterval(state.passwordValidationTimer);@@ -227,16 +272,6 @@ export default defineComponent({}};- const changePassword = (value: string) => {- state.password = value;- refreshPasswordValidation();- };-- const changePasswordConfirm = (value: string) => {- state.passwordConfirm = value;- refreshPasswordValidation();- };-const onTextEmail = () => {const email = state.email.trim();if (!state.nameManuallyEdited) {@@ -263,6 +298,10 @@ export default defineComponent({state.nameManuallyEdited = name.length > 0;};+ const onToggleAcceptTermsAndPolicyCheckbox = () => {+ state.acceptTermsAndPolicy = !state.acceptTermsAndPolicy;+ };+const trySignup = () => {if (!passwordMatch.value) {state.showPasswordMismatchError = true;@@ -289,11 +328,11 @@ export default defineComponent({state,needAdminSetup,allowSignup,- changePassword,- changePasswordConfirm,onTextEmail,onTextName,+ onToggleAcceptTermsAndPolicyCheckbox,trySignup,+ refreshPasswordValidation,};},});