PanJiaChen/vue-admin-template · error · Error

Please enter the correct user name

Error message

Please enter the correct user name

What it means

Login form validation error raised by the async-validator username rule: fires when the entered username fails the validUsername helper (anything other than the whitelisted 'admin' account), blocking form submission until a valid username is entered.

Source

Thrown at src/views/login/index.vue:63

      <div class="tips">
        <span style="margin-right:20px;">username: admin</span>
        <span> password: any</span>
      </div>

    </el-form>
  </div>
</template>

<script>
import { validUsername } from '@/utils/validate'

export default {
  name: 'Login',
  data() {
    const validateUsername = (rule, value, callback) => {
      if (!validUsername(value)) {
        callback(new Error('Please enter the correct user name'))
      } else {
        callback()
      }
    }
    const validatePassword = (rule, value, callback) => {
      if (value.length < 6) {
        callback(new Error('The password can not be less than 6 digits'))
      } else {
        callback()
      }
    }
    return {
      loginForm: {
        username: 'admin',
        password: '111111'
      },
      loginRules: {
        username: [{ required: true, trigger: 'blur', validator: validateUsername }],

View on GitHub (pinned to 4c18a3f47b)

Solutions

  1. Enter a whitelisted username (admin in this template)
  2. Extend the whitelist in src/utils/validate.js if additional accounts should be accepted
  3. Replace validUsername with real server-side authentication for production use
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/views/login/index.vue:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of PanJiaChen/vue-admin-template@4c18a3f47b (2026-09-02). Data as JSON: /api/errors/a29bb224147f2314. Report an issue: GitHub.