diff --git a/src/main/java/de/mattv/fileserver/data/Token.java b/src/main/java/de/mattv/fileserver/data/Token.java index 95b5c3b..f17bd00 100644 --- a/src/main/java/de/mattv/fileserver/data/Token.java +++ b/src/main/java/de/mattv/fileserver/data/Token.java @@ -27,7 +27,11 @@ public class Token implements Authentication { public boolean isAdmin() { return (sudoRealUser != null) || user.admin; } public User getRealUser() { return sudoRealUser != null ? sudoRealUser : user; } - public void unSudo() { if (sudoRealUser != null) user = sudoRealUser; } + public void unSudo() { + if (sudoRealUser != null) + user = sudoRealUser; + sudoRealUser = null; + } public void sudo(@NonNull User newUser) { if (this.sudoRealUser == null) sudoRealUser = user;