Skip to content
Snippets Groups Projects
Commit 60977e94 authored by Dominik Seeger's avatar Dominik Seeger :ghost:
Browse files

Resolve "Tutor assignments not freed when logging out"

parent 74228073
No related branches found
No related tags found
1 merge request!233Resolve "Tutor assignments not freed when logging out"
Pipeline #128234 passed
......@@ -80,9 +80,10 @@ function logout (
message = ''
) {
if (Authentication.isStudent && !ConfigModule.state.config.exerciseMode) {
// change active to false when user logs out
// TODO this should belong in auth module
api.changeActiveForUser(Authentication.state.user.pk, false)
Authentication.deactivateUserAccount()
}
if (Authentication.isTutorOrReviewer) {
Assignments.cleanAssignments()
}
router.push({ name: 'login' }, () => {
resetState({ message })
......
......@@ -112,6 +112,14 @@ async function getUser () {
}
}
/**
* Deactivates the current user's account.
* They will not be able to login again until activated again.
*/
async function deactivateUserAccount ({ state }: BareActionContext<AuthState, RootState>) {
api.changeActiveForUser(state.user.pk, false)
}
export const Authentication = {
get state () { return stateGetter() },
get gradySpeak () { return gradySpeakGetter() },
......@@ -131,4 +139,5 @@ export const Authentication = {
getJWT: mb.dispatch(getJWT),
refreshJWT: mb.dispatch(refreshJWT),
getUser: mb.dispatch(getUser),
deactivateUserAccount: mb.dispatch(deactivateUserAccount),
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment