Permalink
Browse files

Error Message anzeigen wenn falscher Login

  • Loading branch information...
1 parent 9b17065 commit 6d79575c6b33aec9e11a3b065b3a3fc6c184bdee Stephan committed Dec 5, 2012
Showing with 25 additions and 21 deletions.
  1. +0 −1 app/app.js
  2. +2 −2 server.js
  3. +23 −18 views/login.ejs
View
@@ -69,7 +69,6 @@ function($, _, Backbone) {
// Insert into the DOM.
$('#stage').empty().append(layout.el);
- $('#stage').fadeIn('slow');
// Render the layout.
layout.render();
View
@@ -240,7 +240,7 @@ function staticRequest (req, res){
app.get('/login', function(req, res){
- res.render('login', { user: req.user, message: 'Login' });
+ res.render('login', { user: req.user, message: req.flash().error });
});
app.post('/upload', uploadHandler);
@@ -283,7 +283,7 @@ function uploadHandler (req , res){
//
// curl -v -d "username=bob&password=secret" http://127.0.0.1:3000/login
app.post('/login', express.bodyParser(),
- passport.authenticate('local', { failureRedirect: '/login', failureFlash: true }),
+ passport.authenticate('local', { failureRedirect: '/index', failureFlash: true }),
function(req, res) {
res.redirect('/');
});
View
@@ -1,24 +1,29 @@
+<% if (message) { %>
+ <div class="container">
+ <div class="row">
+ <div class="alert alert-error">
+ <strong>Error! </strong><%= message %>
+ </div>
+ </div>
+ </div>
+<% } %>
+
<div class="container">
<div class="row">
<div class="offset4 span4">
- <% if (message) { %>
- <p><%= message %></p>
- <% } %>
-
- <form action="/login" method="post">
- <div>
- <label>Username:</label>
- <input type="text" name="username"/><br/>
- </div>
- <div>
- <label>Password:</label>
- <input type="password" name="password"/>
- </div>
- <div>
- <input type="submit" value="Submit"/>
- </div>
- </form>
-
+ <form action="/login" method="post">
+ <div>
+ <label>Username:</label>
+ <input type="text" name="username"/><br/>
+ </div>
+ <div>
+ <label>Password:</label>
+ <input type="password" name="password"/>
+ </div>
+ <div>
+ <input type="submit" value="Submit"/>
+ </div>
+ </form>
</div>
</div>
</div>

0 comments on commit 6d79575

Please sign in to comment.