moved security-checks into this file
This commit is contained in:
parent
ed0c1c3703
commit
c5ffe969e5
1 changed files with 18 additions and 0 deletions
18
code/Root/securityFunctions.js
Normal file
18
code/Root/securityFunctions.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* check if user is allowed to create a new weblog
|
||||
*/
|
||||
|
||||
function isAddAllowed() {
|
||||
if (!user.uid) {
|
||||
res.message = "Please login first!";
|
||||
user.cache.referer = root.href("new");
|
||||
res.redirect(root.members.href("login"));
|
||||
} else if (user.isBlocked()) {
|
||||
res.message = "Sorry, your account was disabled!";
|
||||
return false;
|
||||
} else if (user.getWeblog()) {
|
||||
res.message = "You already own a Weblog! You'll need a new account to create another one.";
|
||||
res.redirect(root.members.href("register"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue