mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 12:29:26 +01:00
some other stuff and the login view. there is some stupid issue picking up the credentials from the form though idk
This commit is contained in:
parent
f53b826307
commit
12e11e78c1
@ -20,9 +20,17 @@ var webInterface = function(dbot) {
|
||||
|
||||
this.app.use(passport.initialize());
|
||||
this.app.use(passport.session());
|
||||
this.app.use(app.router);
|
||||
this.app.use(this.app.router);
|
||||
|
||||
passport.use(new LocalStrategy(function(username, pass, callback) {
|
||||
passport.serializeUser(function(user, done) {
|
||||
done(null, user);
|
||||
});
|
||||
|
||||
passport.deserializeUser(function(obj, done) {
|
||||
done(null, obj);
|
||||
});
|
||||
|
||||
passport.use(new LocalStrategy(function(username, password, callback) {
|
||||
var splitUser = username.split('@'),
|
||||
server = splitUser[1],
|
||||
username = splitUser[0];
|
||||
@ -45,7 +53,7 @@ var webInterface = function(dbot) {
|
||||
return callback(null, false, { 'message': 'Unknown user' });
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this)));
|
||||
|
||||
var server = this.app.listen(this.config.webPort);
|
||||
|
||||
@ -89,9 +97,9 @@ var webInterface = function(dbot) {
|
||||
});
|
||||
|
||||
this.app.get('/login', function(req, res) {
|
||||
res.render('login', function(req, res) {
|
||||
res.render('login', {
|
||||
'user': req.user,
|
||||
'message': req.flash('error');
|
||||
'message': req.flash('error')
|
||||
});
|
||||
});
|
||||
|
||||
|
19
views/login.jade
Normal file
19
views/login.jade
Normal file
@ -0,0 +1,19 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
div#backlink
|
||||
a(href='/') « Home
|
||||
br
|
||||
if message
|
||||
p #{message}
|
||||
div#login
|
||||
form(action='/login', method='post')
|
||||
p
|
||||
key Username
|
||||
input(type="text", name="username")
|
||||
p
|
||||
key Password
|
||||
input(type="password", name="password")
|
||||
p
|
||||
input(type="submit", value="Log In")
|
||||
|
Loading…
Reference in New Issue
Block a user