Session object deletion on logout;
This commit is contained in:
+13
-12
@@ -1,8 +1,8 @@
|
||||
function clearAuthState() {
|
||||
auth.user = ''; // Login name
|
||||
auth.name = ''; // Full name
|
||||
auth.type = ''; // type of login (domain specific)
|
||||
auth.mail = ''; // Full mail address
|
||||
auth.type = ''; // type of login (domain specific)
|
||||
auth.roles = {}; // Role authorizations e.g. {user: true}
|
||||
auth.gender = ''; // Gender (e.g. Frau)
|
||||
auth.abos = []; // Followed tags
|
||||
@@ -24,15 +24,16 @@ function updateUserInDB() {
|
||||
$.ajax({
|
||||
url: "api/usr",
|
||||
data: {
|
||||
_id: auth.user,
|
||||
name: auth.name,
|
||||
mail: auth.mail,
|
||||
type: auth.type,
|
||||
gender: auth.gender,
|
||||
roles: JSON.stringify(auth.roles),
|
||||
abos: JSON.stringify(auth.abos),
|
||||
bookmarks: JSON.stringify(auth.bookmarks),
|
||||
mail: auth.mail,
|
||||
name: auth.name,
|
||||
_id: auth.user,
|
||||
roles: JSON.stringify(auth.roles),
|
||||
type: auth.type,
|
||||
},
|
||||
method: "POST"
|
||||
method: "PUT"
|
||||
}).done(successful_save).fail(failed_save);
|
||||
|
||||
function successful_save(res) {
|
||||
@@ -74,7 +75,7 @@ Vue.component('login-panel', {
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-checkbox>Eingeloggt bleiben</b-checkbox>
|
||||
<div v-if="error" style="color:red;"> Versuche es nochmal.</div>
|
||||
<div v-if="error" :key="error" style="color:red;"> Versuche es nochmal.</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button" type="button" @click.prevent="$parent.close()">Close</button>
|
||||
@@ -90,9 +91,9 @@ Vue.component('login-panel', {
|
||||
},
|
||||
// TODO: Check if enough for session cookie re-login; checkbox
|
||||
// Doesn't work
|
||||
// mounted: function() {
|
||||
// this.checkData();
|
||||
// },
|
||||
beforeMount: function() {
|
||||
this.checkData();
|
||||
},
|
||||
methods: {
|
||||
closeLoginPanel: function() {
|
||||
this.$emit('close-login-panel');
|
||||
@@ -120,7 +121,7 @@ Vue.component('login-panel', {
|
||||
|
||||
function successful_login(resData) {
|
||||
fillAuthState(resData);
|
||||
updateUserInDB();
|
||||
// updateUserInDB();
|
||||
console.info("Correct credentials");
|
||||
this.closeLoginPanel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user