Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User extraction may fail for different backends #197

Open
sgobotta opened this issue Feb 1, 2020 · 0 comments
Open

User extraction may fail for different backends #197

sgobotta opened this issue Feb 1, 2020 · 0 comments
Labels
bug Something isn't working ux

Comments

@sgobotta
Copy link
Member

sgobotta commented Feb 1, 2020

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:

  1. Make sure your backend responds the AUTH_LOGIN_REQUEST with a user without an email field.
  2. Try to log in
  3. The alert system should break because it assumes every extracted user has an email value. 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

@sgobotta sgobotta added bug Something isn't working ux labels Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ux
Projects
None yet
Development

No branches or pull requests

1 participant