forked from balderdashy/sails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5af22c5
commit 7c36901
Showing
7 changed files
with
100 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* `isAuthenticated` | ||
* | ||
* Simple policy to allow any authenticated user | ||
* Assumes that your login action (in one of your controllers) sets: | ||
* `req.session.authenticated = true;` | ||
*/ | ||
module.exports = function(req, res, next) { | ||
|
||
// User is allowed, proceed to the next policy, | ||
// or if this is the last policy, the controller | ||
if (req.session.authenticated) { | ||
return next(); | ||
} | ||
|
||
// User is not allowed | ||
// (default res.forbidden() behavior can be overridden in `config/403.js`) | ||
return res.forbidden('You are not permitted to perform this action.'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
This is the default 403 page, shown when you call: | ||
`return res.forbidden();` | ||
from one of your policies. | ||
User agents that don't "Accept" HTML will see a JSON version instead. | ||
You can customize the control logic for your needs in `config/403.js` | ||
--> | ||
<html> | ||
<head> | ||
<title>Forbidden</title> | ||
<link href='http://sailsjs.org/styles/fonts.css' rel='stylesheet'/> | ||
<style> | ||
/* Styles included inline since you'll probably be deleting or replacing this page anyway */ | ||
html,body{text-align:left;font-size:1em}html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0}ul,li{list-style:none}img{display:block}a img{border:0}a{text-decoration:none;font-weight:normal;font-family:inherit}*:active,*:focus{outline:0;-moz-outline-style:none}h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em}.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden}.page .ocean{background:url('http://sailsjs.com/images/waves.png') #0c8da0 no-repeat center 0;height:315px}.page .ocean img{margin-right:auto;margin-left:auto}.page .waves{display:block;padding-top:25px;margin-right:auto;margin-left:auto}.page .main{display:block;margin-top:90px}.page .logo{width:150px;margin-top:3.5em;margin-left:auto;margin-right:auto}.page .fishy{display:block;padding-top:27px}.page .help{padding-top:2em}.page h1{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:bold;font-size:1.7em;color:#001c20;text-align:center}.page h2{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:300;font-size:1.5em;color:#001c20;text-align:center}.page p{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-size:1.25em;color:#001c20;text-align:center}.page a{color:#118798}.page a:hover{color:#b1eef7} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="page"> | ||
<div class="ocean"> | ||
<img class="fishy" src="http://sailsjs.org/images/fishy4.png"> | ||
</div> | ||
|
||
<div class="main"> | ||
<h1> | ||
Forbidden | ||
</h1> | ||
<h2> | ||
<% if (typeof message !== 'undefined') { %> | ||
<%= message %> | ||
<% } else { %> | ||
You don't have permission to see the page you're trying to reach. | ||
<% } %> | ||
</h2> | ||
<p class="help"> | ||
<a href="/">Why</a> might this be happening? | ||
</p> | ||
</div> | ||
|
||
<div class="logo"> | ||
<a href="http://sailsjs.org"> | ||
<img src="http://sailsjs.org/images/logo.png"> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
</html> |