Compare commits

..

3 Commits

Author SHA1 Message Date
77ac771b8f Merge remote-tracking branch 'origin/Max/Backend/UserDelete' into wal/front/listingUsers
Some checks failed
Build and test backend / Build-backend (pull_request) Failing after 1m31s
Build and test backend / Test-backend (pull_request) Failing after 1m31s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 23s
2024-03-18 17:36:07 +01:00
3762750968 Tempo 2024-03-18 17:34:35 +01:00
a276c24f8f added delete self
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m2s
Build and test backend / Test-backend (pull_request) Successful in 2m0s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 25s
2024-03-18 17:30:04 +01:00
3 changed files with 7 additions and 6 deletions

View File

@ -125,7 +125,7 @@ public class UserController {
@DeleteMapping("/user/{id}")
public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) || id.equals(authServ.getUserFromToken(token).getRegNo()))
return new UnauthorizedResponse<>(null);
User toDelete = userService.getUserById(id);

View File

@ -15,11 +15,10 @@ window.onhashchange = function() {
const Logged = ref(isLogged());
window.addEventListener('hashchange', () => {
if((location.hash === "#/home" && prevURL === "#/login") || location.hash === "#/home" && prevURL === "#/profil" && !Logged)){
if((location.hash === "#/home" && prevURL === "#/login") || (location.hash === "#/home" && prevURL === "#/profil")){
window.location.reload();
}
})
});
const home=ref(i18n("app.home"))
const notifications=ref(i18n("app.notifications"))
const settings=ref(i18n("app.settings"))

View File

@ -56,8 +56,10 @@
}
async function unRegister(){
await deleteUser(user.regNo);
disconnect();
setTimeout(() => {
window.location.href="#/home";
}, "500");
}