Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: The forgot password page displays an error --bug=1055073 --user=王孝刚 【长城开发科技】自定平台登录设置在点击忘记密码时还是默认提示 https://www.tapd.cn/57709429/s/1689108

--bug=1055073 --user=王孝刚 【长城开发科技】自定平台登录设置在点击忘记密码时还是默认提示 https://www.tapd.cn/57709429/s/1689108
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Apr 22, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Apr 22, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wxg0103 wxg0103 merged commit f1d043f into main Apr 22, 2025
4 checks passed
@wxg0103 wxg0103 deleted the pr@main@fix_1055073 branch April 22, 2025 06:19
const { user } = useStore()
const CheckEmailForm = ref<CheckCodeRequest>({
email: '',
code: '',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code has a few areas that can be improved:

  1. Template Optimization: The template contains two consecutive <br> tags at lines 3 and 48. Instead of using </br>, which is not standard HTML syntax, you should use line breaks for readability.

  2. Component Props Handling: In the <LoginContainer> component, the sub-title is set based on user.themeInfo.slogan if it exists, otherwise it defaults to $t('views.system.theme.defaultSlogan'). This handling ensures that no error occurs if themeInfo or its properties do not exist.

  3. Button Disabled State: It appears there might be an issue with how the button's disabled state is updated, especially related to the timing (time) variable. Ensure this logic updates correctly to prevent unexpected behavior when resendTime expires.

  4. Dynamic Content Handling: When displaying dynamic content such as verification messages or buttons, consider using proper Vue.js directives like v-if and other controls to handle their visibility dynamically without resorting to conditional statements inside strings.

  5. Globalization Considerations: If internationalization (i18n) is handled through external libraries like i18next or vue-i18n, ensure consistency across all usage of translations, including static texts within elements' text nodes like headings and button captions. Using consistent data structure patterns for storing translated information can help maintain clarity and reduce errors during localization efforts.

Here is a slightly reformatted version with these considerations incorporated:

<template>
  <login-layout>
    <LoginContainer :subTitle="getSubtitle">
      <h2 class="mb-24"> {{ t('views.login.forgotPassword') }} </h2>

      <el-form class="register-form">
        ...

        <button-size large type="primary" class="w-full" @click="checkCode">
          {{ $t('views.login.buttons.checkCode') }}
        </button-size>

        ...
        
      </el-form>
  
      <!-- Other components -->
      
    </LoginContainer>
  </login-layout>
</template>

<script lang="ts">

// Assuming getSubtitle() function calculates the subtitle string

setup () {
  // Your setup code here...

  return {
    t,
    checkCode,
    sendAgain,
    resendTimer: undefined,
    formRef,

    calculatedSubtitle: computed(() => (
      user.themeInfo && user.themeInfo.slogan !== null &&
      typeof user.themeInfo.slogan === 'string'
        ? user.themeInfo.slogan
        : t('views.system.theme.defaultSlogan')
    ))
  }
}

</script>

<style scoped>
/* Your styles here */
</style>

This refactoring helps maintain better organization and avoids several common pitfalls in Vue.js development practices. Make sure to adjust getSubtitle() according to your actual implementation if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants