[guadec-web-regcfp/develop] Rework stuff
- From: Patrick Uiterwijk <puiterwijk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web-regcfp/develop] Rework stuff
- Date: Thu, 21 May 2015 12:43:39 +0000 (UTC)
commit 017aed2c6093c61ef6e32064c32adca47be51481
Author: Patrick Uiterwijk <puiterwijk redhat com>
Date: Thu May 21 14:37:24 2015 +0200
Rework stuff
routes/auth.js | 1 +
utils.js | 11 +++++++++++
views/papers/submit.hbs | 4 ++--
3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/routes/auth.js b/routes/auth.js
index 40f76d1..c4f65bd 100644
--- a/routes/auth.js
+++ b/routes/auth.js
@@ -61,6 +61,7 @@ router.post('/logout', function(req, res, next) {
res.send('Logged out');
});
+router.all('/register', utils.require_login);
router.get('/register', function(req, res, next) {
res.render('auth/register', { origin: req.query.origin });
});
diff --git a/utils.js b/utils.js
index 5699eea..db8ad7c 100644
--- a/utils.js
+++ b/utils.js
@@ -61,7 +61,18 @@ utils.require_permission = function(permission) {
};
};
+utils.require_login = function(req, res, next) {
+ if(req.session.currentUser == null) {
+ res.render('auth/no_permission', { required_permission: 'Login' });
+ }
+};
+
utils.require_user = function(req, res, next) {
+ if(!req.session.currentUser) {
+ res.render('auth/no_permission', { required_permission: 'Login' });
+ return;
+ }
+
User.find({
where: {
email: req.session.currentUser
diff --git a/views/papers/submit.hbs b/views/papers/submit.hbs
index fad79fd..f1f2ae9 100644
--- a/views/papers/submit.hbs
+++ b/views/papers/submit.hbs
@@ -4,8 +4,8 @@
<form action="/papers/submit" method="post">
<table class="submission-form">
-<tr><td>Submitter:</td><td><input type="text" value="{{session.currentUser}}" disabled /></td></tr>
-<tr><td>Your name:</td><td><input type="text" name="submitter_name" value="{{submitter_name}}" disabled
/></td></tr>
+<tr><td>Submitter:</td><td><input type="text" value="{{user.email}}" disabled /></td></tr>
+<tr><td>Your name:</td><td><input type="text" name="submitter_name" value="{{user.name}}" disabled
/></td></tr>
<tr><td>Paper title:</td><td><input type="text" name="paper_title" value="{{paper_title}}" maxlength=50
/></td></tr>
<tr><td>Paper summary:</td>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]