diff --git a/resources/i18n/en.json5 b/resources/i18n/en.json5
index 7f9c41c366..d41f314325 100644
--- a/resources/i18n/en.json5
+++ b/resources/i18n/en.json5
@@ -1754,6 +1754,8 @@
"nav.statistics.header": "Statistics",
+ "nav.stop-impersonating": "Stop impersonating EPerson",
+
"orgunit.listelement.badge": "Organizational Unit",
diff --git a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
index f886514ded..f221042418 100644
--- a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
+++ b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
@@ -402,7 +402,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
* Stop impersonating the EPerson
*/
stopImpersonating() {
- this.authService.stopImpersonating();
+ this.authService.stopImpersonatingAndRefresh();
this.isImpersonated = false;
}
diff --git a/src/app/core/auth/auth.effects.ts b/src/app/core/auth/auth.effects.ts
index 35d5e7b043..717aaff01e 100644
--- a/src/app/core/auth/auth.effects.ts
+++ b/src/app/core/auth/auth.effects.ts
@@ -201,6 +201,7 @@ export class AuthEffects {
.pipe(
ofType(AuthActionTypes.LOG_OUT),
switchMap(() => {
+ this.authService.stopImpersonating();
return this.authService.logout().pipe(
map((value) => new LogOutSuccessAction()),
catchError((error) => observableOf(new LogOutErrorAction(error)))
diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts
index 7d642e60d2..ce0fafe277 100644
--- a/src/app/core/auth/auth.service.ts
+++ b/src/app/core/auth/auth.service.ts
@@ -513,6 +513,13 @@ export class AuthService {
*/
stopImpersonating() {
this.storage.remove(IMPERSONATING_COOKIE);
+ }
+
+ /**
+ * Stop impersonating EPerson and refresh the store/ui
+ */
+ stopImpersonatingAndRefresh() {
+ this.stopImpersonating();
this.refreshAfterLogout();
}
diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html
index 58f7cb1ecf..5ce0cdb410 100644
--- a/src/app/header/header.component.html
+++ b/src/app/header/header.component.html
@@ -8,6 +8,7 @@
+