Skip to content
Browse files

Normalizacion, coool stuff here.

  • Loading branch information...
1 parent 28944e6 commit b39b9b8f4e553a1877c53ebcb8a0bfd43fbe6885 @outaTiME committed Nov 14, 2012
View
17 app.js
@@ -44,6 +44,8 @@ i18n.init({
// configuration
app.configure(function () {
+
+ // default
app.set('port', process.env.PORT || config.server.port);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
@@ -68,7 +70,16 @@ app.configure(function () {
app.use(passport.initialize());
app.use(passport.session());
app.use(i18n.handle);
+
+ // helpers
+ app.use(function (req, res, next) {
+ res.locals.isAuthenticated = req.isAuthenticated();
+ next();
+ });
+
+ // router
app.use(app.router);
+
// bp
app.use(h5bp.ieEdgeChromeFrameHeader());
app.use(h5bp.protectDotfiles());
@@ -143,7 +154,6 @@ passport.use(new LocalStrategy(
app.get('/login', function (req, res) {
var user = req.user, message = req.flash('error');
- console.info(message);
res.render('login', {
user: user,
message: message
@@ -163,11 +173,6 @@ app.get('/logout', function (req, res) {
res.redirect('/');
});
-// Simple route middleware to ensure user is authenticated.
-// Use this route middleware on any resource that needs to be protected. If
-// the request is authenticated (typically via a persistent login session),
-// the request will proceed. Otherwise, the user will be redirected to the
-// login page.
function ensureAuthenticated(req, res, next) {
if (req.isAuthenticated()) {
return next();
View
14 locales/en/translation.json
@@ -1,6 +1,16 @@
{
- "app": {
- "message": "Hello from nbp!"
+ "title": "Node Boilerplate",
+ "login": {
+ "title": "Log In",
+ "page_title": "$t(login.title) — $t(title)",
+ "username": "Username",
+ "password": "Password",
+ "signin": "Sign In",
+ "error": "Error found while trying to authenticate user."
+ },
+ "index": {
+ "message": "Hello from nbp!",
+ "login": "$t(login.title)"
}
}
View
9 locales/es/translation.json
@@ -1,6 +1,13 @@
{
- "app": {
+ "login": {
+ "title": "Acceder",
+ "username": "Nombre de usuario",
+ "password": "Contraseña",
+ "signin": "Entrar",
+ "error": "Se ha producido un error mientras se intentaba autenticar al usuario."
+ },
+ "index": {
"message": "Hola desde nbp!"
}
}
View
2 public/stylesheets/vendor/bootstrap.min.css
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 stylesheets/nbp.styl
@@ -5,8 +5,8 @@
body {
background: url("/images/light_noise_diagonal.png") center top repeat;
- font-size: 13px;
- line-height: 18px;
+ /* font-size: 13px;
+ line-height: 18px; */
}
/** Touch **/
@@ -65,6 +65,12 @@ form {
margin: 0;
}
+/** Index **/
+
+.index h2 {
+ margin-bottom: 18px;
+}
+
/** Flex **/
.flex {
View
7 views/index.jade
@@ -1,4 +1,9 @@
extends templates/box
append box
- h2= t('app.message')
+ .index
+ h2= t('index.message')
+ - if (!isAuthenticated) {
+ a.btn.btn-primary.btn-large(href="login") #{t("index.login")}
+ - }
+
View
22 views/login.jade
@@ -1,29 +1,27 @@
extends templates/dialog
block title
- title Log In — Node Boilerplate
+ title= t("login.page_title")
append box
-
- script(type="text/javascript")
- var data = !{JSON.stringify(message)};
-
.login
- h2 Log In
+ h2= t("login.title")
hr.soften
+ - var klass = ''
- if (message.length > 0) {
+ - klass = 'error';
.alert.alert-error
strong Oh snap! 
- | Error found while trying to authenticate user.
+ | #{t("login.error")}
- }
form(action="/login", method='POST')
fieldset
div
- .control-group
+ .control-group(class=klass)
.controls
- input(name="username", type="text", placeholder="Username", autofocus)
- .control-group
+ input(name="username", type="text", placeholder=t("login.username"), autofocus)
+ .control-group(class=klass)
.controls
- input(name="password", type="password", placeholder="Password")
+ input(name="password", type="password", placeholder=t("login.password"))
.submit
- button.btn.btn-primary(type="submit", onclick="$(this).css('visibility', 'hidden');") Sign In
+ button.btn.btn-primary(type="submit", onclick="$(this).css('visibility', 'hidden');") #{t("login.signin")}
View
2 views/templates/layout.jade
@@ -3,7 +3,7 @@ html(class="no-js", lang="en")
head
meta(charset="utf-8")
block title
- title Node Boilerplate
+ title= t("title")
meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no")
meta(name="apple-mobile-web-app-capable", content="yes")
meta(name="apple-mobile-web-app-status-bar-style", content="black")

0 comments on commit b39b9b8

Please sign in to comment.
Something went wrong with that request. Please try again.