ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix user tests
Chocobozzz5960f92395e8
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.tsindex 9976993e03..41a3fb7189 100644--- a/server/middlewares/oauth.ts+++ b/server/middlewares/oauth.ts@@ -15,7 +15,7 @@ function authenticate (req: express.Request, res: express.Response, next: expresif (err) {return res.status(err.status).json({- error: 'Authentication failed.',+ error: 'Token is invalid.',code: err.name}).end()@@ -26,7 +26,18 @@ function authenticate (req: express.Request, res: express.Response, next: expres}function token (req: express.Request, res: express.Response, next: express.NextFunction) {- return oAuthServer.token()(req, res, next)+ return oAuthServer.token()(req, res, err => {+ if (err) {+ return res.status(err.status)+ .json({+ error: 'Authentication failed.',+ code: err.name+ })+ .end()+ }++ return next()+ })}// ---------------------------------------------------------------------------diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.tsindex b7ec3bc0fd..a13807b5c0 100644--- a/server/tests/api/users/users.ts+++ b/server/tests/api/users/users.ts@@ -42,7 +42,7 @@ describe('Test users', function () {expect(res.body.error).to- .equal('invalid_client')+ .equal('Authentication failed.')})it('Should not login with an invalid client secret', async function () {@@ -51,7 +51,7 @@ describe('Test users', function () {expect(res.body.error).to- .equal('invalid_client')+ .equal('Authentication failed.')})it('Should not login with an invalid username', async function () {@@ -60,7 +60,7 @@ describe('Test users', function () {expect(res.body.error).to- .equal('invalid_grant')+ .equal('Authentication failed.')})it('Should not login with an invalid password', async function () {@@ -69,7 +69,7 @@ describe('Test users', function () {expect(res.body.error).to- .equal('invalid_grant')+ .equal('Authentication failed.')})it('Should not be able to upload a video', async function () {