-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Describe the bug
Vue-Admin and many other administration applications tend to make use of a username to show welcome messagesor any other message that needs a kind of presentation to that individual.
In Vue-Admin there's currently a way to extract the current user, where a username or email can be found, though there's no way to get to know which is the field where this username will be extracted from.
We can notice the authentication system uses authFields:
const authFields = { username: 'username', password: 'password' }There also this userField variable the authentication adapter will use to extract the user from successful responses:
const userField = 'user'To Reproduce
Steps to reproduce the behavior:
- Make sure your backend responds the
AUTH_LOGIN_REQUESTwith a user without anemailfield. - Try to log in
- The alert system should break because it assumes every extracted user has an
emailvalue. The snackbar text welcome has an empty string where the name should be located.
Expected behavior
The snackbar, and any other Vue-Admin component should not worry about the user response structure. Vue-Admin should let users define expected attribute fields of the user object in authentication responses