aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-15 12:26:02 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-15 12:26:02 +0200
commitc9d6d155c397d0da0cb2d50064264fc1716f0501 (patch)
treec9f888f1d294f2097f43ffd9fc6875bdf1565007 /client/src/app
parentb60e5f38daf77e720a27aa86d3b482c58906a03a (diff)
downloadPeerTube-c9d6d155c397d0da0cb2d50064264fc1716f0501.tar.gz
PeerTube-c9d6d155c397d0da0cb2d50064264fc1716f0501.tar.zst
PeerTube-c9d6d155c397d0da0cb2d50064264fc1716f0501.zip
Fix login when there is an error
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/login/login.component.ts8
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts4
2 files changed, 6 insertions, 6 deletions
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 77703a80c..32dc9e36f 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -56,13 +56,11 @@ export class LoginComponent extends FormReactive implements OnInit {
56 this.authService.login(username, password).subscribe( 56 this.authService.login(username, password).subscribe(
57 result => this.router.navigate(['/videos/list']), 57 result => this.router.navigate(['/videos/list']),
58 58
59 error => { 59 err => {
60 console.error(error.json) 60 if (err.message === 'invalid_grant') {
61
62 if (error.json.error === 'invalid_grant') {
63 this.error = 'Credentials are invalid.' 61 this.error = 'Credentials are invalid.'
64 } else { 62 } else {
65 this.error = `${error.json.error}: ${error.json.error_description}` 63 this.error = `${err.body.error_description}`
66 } 64 }
67 } 65 }
68 ) 66 )
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index 62c600d25..aafc9723e 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -54,11 +54,13 @@ export class RestExtractor {
54 54
55 const errorObj = { 55 const errorObj = {
56 message: errorMessage, 56 message: errorMessage,
57 status: undefined 57 status: undefined,
58 body: undefined
58 } 59 }
59 60
60 if (err.status) { 61 if (err.status) {
61 errorObj.status = err.status 62 errorObj.status = err.status
63 errorObj.body = err.error
62 } 64 }
63 65
64 return Observable.throw(errorObj) 66 return Observable.throw(errorObj)