mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
account page shows up when logged in and 403 when logged out
This commit is contained in:
18
public/templates/account.tpl
Normal file
18
public/templates/account.tpl
Normal file
@@ -0,0 +1,18 @@
|
||||
<h1>Account Settings</h1>
|
||||
<div class="well">
|
||||
<div class="alert" id="message" style="display:none">
|
||||
<button type="button" class="close" data-dismiss="message">×</button>
|
||||
<strong></strong>
|
||||
<p></p>
|
||||
</div>
|
||||
<label for="email">Email Address</label><input type="text" placeholder="Enter Email Address" id="email" /><br />
|
||||
<button class="btn btn-primary" id="reset" type="submit">Reset Password</button>
|
||||
<p>
|
||||
If you see this, you are logged in.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
// ...
|
||||
}());
|
||||
</script>
|
||||
@@ -30,7 +30,7 @@
|
||||
<li class="active"><a href="/">Forum</a></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right" id="right-menu">
|
||||
<li><a href="#" id="user_label"></a></li>
|
||||
<li><a href="/account" id="user_label"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
Templates.init = function() {
|
||||
loadTemplates([
|
||||
'header', 'footer', 'register', 'home', 'topic',
|
||||
'header', 'footer', 'register', 'home', 'topic', 'account',
|
||||
'login', 'reset', 'reset_code', 'logout',
|
||||
'403',
|
||||
'emails/reset', 'emails/reset_plaintext'
|
||||
|
||||
@@ -78,14 +78,6 @@ passport.deserializeUser(function(uid, done) {
|
||||
(function(app) {
|
||||
var templates = global.templates;
|
||||
|
||||
function refreshTemplates() {
|
||||
//need a better solution than copying this code on every call. is there an "onconnect" event?
|
||||
if (DEVELOPMENT === true) {
|
||||
// refreshing templates
|
||||
modules.templates.init();
|
||||
}
|
||||
}
|
||||
|
||||
// Middlewares
|
||||
app.use(express.favicon()); // 2 args: string path and object options (i.e. expire time etc)
|
||||
app.use(require('less-middleware')({ src: path.join(__dirname, '../', '/public') }));
|
||||
@@ -259,8 +251,11 @@ passport.deserializeUser(function(uid, done) {
|
||||
});
|
||||
|
||||
app.get('/account', function(req, res) {
|
||||
refreshTemplates();
|
||||
res.send(templates['header'] + templates['account_settings'] + templates['footer']);
|
||||
|
||||
if (req.user === undefined)
|
||||
return res.redirect('/403');
|
||||
|
||||
res.send(templates['header'] + templates['account'] + templates['footer']);
|
||||
});
|
||||
|
||||
app.get('/users', function(req, res) {
|
||||
|
||||
Reference in New Issue
Block a user