Cambalab / vue-admin

An open source frontend Framework for building admin applications running in the browser on top of REST, using ES6 and Vue.js
GNU General Public License v3.0
132 stars 24 forks source link

Feedback on failing authentication #188

Closed jejoivanic closed 4 years ago

jejoivanic commented 4 years ago

Description

This PR provides:

Closes https://github.com/Cambalab/vue-admin/issues/180

Type of change

How Has This Been Tested?

Apart from running all previous tests (unit/e2e) two different e2e tests were added. Those are

Checklist:

jejoivanic commented 4 years ago

Why is this a WIP?

I implemented a solution which requires the user to handle the asyn response from the authentication with a then. In this then's callback the user receives a parameter which represents the error of the response if any. If not, the layout will change and nothing should be received in this parameter.

...
  this.va.login(user, password)
    .then(err => {
      if (err)
        doSomething()
    })
...

I've thought about this solution but I don't really know if this is the right approach for this, however I could not find a better way. I've consider passing also the user, to resemble other libraries which, in similar cases, defines a callback like (data, err) => { ... }. That's my only concern about this solution. I'll wait for some comments or feedback.

jejoivanic commented 4 years ago

I also modified the response from the demo server to return 401 status when the user or password is incorrect.

sgobotta commented 4 years ago

Not really sure what's going on. My guess is that the snackbar disappears before Cypress finally finds it in the virtual dom.

Note: this only happens during the CI, local e2e tests pass successfully.

sgobotta commented 4 years ago

Keeps failing, even with a timeout of 0. I'm going to temporarily remove those tests. It's not a big trouble since the plan is to move the demo to another repository, therefore e2e tests will not be part of the source code anymore.

sgobotta commented 4 years ago

End to end tests for AuthLayout snackbar were removed in 3326fe18eba3d0d13e124adac5a862495b66223b