@@ -51,8 +51,8 @@ Vue.component('profil-card', {
data: function () {
return {
auth: auth,
- abo: 7,
- saved: 3,
+ abos: auth.abos ? auth.abos.length : '-',
+ bookmarks: auth.bookmarks ? auth.bookmarks.length : '-',
isCardModalActive: false,
};
},
@@ -75,6 +75,7 @@ Vue.component('profil-card', {
logout: function() {
clearAuthState();
$.ajax({ url: "api/logout", method: "POST" });
+ vueForceRender();
router.push('/profil');
},
}
diff --git a/public/style/style.css b/public/style/style.css
index 16e5fff..53a6417 100644
--- a/public/style/style.css
+++ b/public/style/style.css
@@ -241,10 +241,15 @@ button.clearButton {
float: right;
}
}
+<<<<<<< HEAD
#subscribe-btn {
float: right;
visibility: hidden;
}
#escape-search-link {
visibility: hidden;
+=======
+#bockmark-not-active {
+ visibility: visible;
+>>>>>>> origin/developer
}
diff --git a/public/style/style.less b/public/style/style.less
index 404487d..fd9811e 100644
--- a/public/style/style.less
+++ b/public/style/style.less
@@ -291,4 +291,10 @@ button.clearButton{
}
#escape-search-link{
visibility: hidden;
+
+#bockmark-not-active{
+ visibility: visible;
+}
+#bockmark-active{
+ //visibility: hidden;
}
diff --git a/server/authorization.js b/server/authorization.js
index 65ce8d8..7138add 100644
--- a/server/authorization.js
+++ b/server/authorization.js
@@ -12,6 +12,16 @@ const ldap = require ('./ldap_ohm'),
const serverVisibleSession = { user: true, name: true, type: true, mail: true, roles: true, gender: true, deactivated: true, host: true };
const clientVisibleSession = { user: true, name: true, type: true, mail: true, roles: true, gender: true };
+// Return user role, query from found.mail
+function getUserRole(found) {
+ var roles = "user";
+ var mail = found.mail;
+ if (!/\d/.test(mail)) {
+ // Mail contains no number
+ roles += ',"author"';
+ }
+ return roles;
+}
// Fill in session object
function fillSession (req, user, roles, cb) {
@@ -22,7 +32,7 @@ function fillSession (req, user, roles, cb) {
req.session.regenerate (function (err) {
if (user !== undefined && ! err) {
common.shallowCopy (user, serverVisibleSession, {roles: true}, req.session);
- console.info(req.session);
+// console.info(req.session);
if (user._id) {
req.session.user = user._id;
}
@@ -37,7 +47,7 @@ function fillSession (req, user, roles, cb) {
// Save found user into DB, if not already exists
function saveFoundToDB(found, cb) {
- console.info(found);
+// console.info(found);
Users.findById(found.user)
.exec(function(err, result){
if (err) {
@@ -52,15 +62,15 @@ function saveFoundToDB(found, cb) {
mail: found.mail,
type: found.type,
gender: found.gender,
-// abos: '',
-// bookmarks: '',
- roles: 'user',
+ abos: '',
+ bookmarks: '',
+ roles: getUserRole(found),
}, function(err, done) {
if (err) {
console.error("User creation: Failed");
console.error(err);
} else {
- console.info("New User created!");
+ console.info("User created: "+ found.user);
}
if (done == null) {
console.error("Can not create user.");
@@ -158,7 +168,7 @@ const authorization = {
console.error(err);
}
});
- console.info(req.session);
+// console.info(req.session);
return res.json ({});
});
},