Merge pull request #1231 from Bnyro/session

log out all devices
This commit is contained in:
Kavin 2022-07-21 09:08:05 +05:30 committed by GitHub
commit c635e1199d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -227,6 +227,12 @@
</div>
<br />
<a class="btn w-auto" @click="logout" v-t="'actions.logout'" />
<a
class="btn w-auto"
style="margin-left: 0.5em"
@click="invalidateSession"
v-t="'actions.invalidate_session'"
/>
<br />
</div>
</template>
@ -480,6 +486,18 @@ export default {
// redirect to trending page
window.location = "/";
},
async invalidateSession() {
this.fetchJson(this.apiUrl() + "/logout", null, {
method: "POST",
headers: {
Authorization: this.getAuthToken(),
},
}).then(resp => {
if (!resp.error) {
this.logout();
} else alert(resp.error);
});
},
},
};
</script>

View File

@ -82,8 +82,9 @@
"delete_playlist_confirm": "Are you sure you want to delete this playlist?",
"please_select_playlist": "Please select a playlist",
"delete_account": "Delete Account",
"logout": "Logout",
"minimize_recommendations_default": "Minimize Recommendations by default"
"logout": "Logout from this device",
"minimize_recommendations_default": "Minimize Recommendations by default",
"invalidate_session": "Logout all devices"
},
"comment": {
"pinned_by": "Pinned by",