SyntaxError: Unexpected token else in nodejs app in line 92 col7 を取得しています
app.js で
var express = require('express'), everyauth = require('everyauth');
everyauth.debug = true;
var usersByLogin = {
'krishna': {
login: 'krishna',
email: 'krishna@blogab.com',
password: 'krishna'
}
};
everyauth
.password
//.loginWith('email')
.loginWith('login')
.getLoginPath('/login')
.postLoginPath('/login')
.loginView('bcore/login.jade')
.loginLocals( function (req, res, done) {
setTimeout( function () {
done(null, {
title: 'blogab - login'
});
}, 200);
})
.authenticate( function (login, password) {
var errors = [];
if (!login) errors.push('Missing login');
if (!password) errors.push('Missing password');
if (errors.length) return errors;
var user = usersByLogin[login];
if (!user) return ['Login failed'];
if (user.password !== password) return ['Login failed'];
return user;
})
.getRegisterPath('/register')
.postRegisterPath('/register')
.registerView('bcore/register.jade')
.registerLocals( function (req, res, done) {
setTimeout( function () {
done(null, {
title: ' Register'
});
}, 200);
})
.extractExtraRegistrationParams( function (req) {
return {
email: req.body.email
};
})
.validateRegistration( function (newUserAttrs, errors) {
var login = newUserAttrs.login;
if (usersByLogin[login]) errors.push('Login already taken');
return errors;
})
.registerUser( function (newUserAttrs) {
var login = newUserAttrs[this.loginKey()];
return usersByLogin[login] = newUserAttrs;
})
.loginSuccessRedirect('/admin/')
.registerSuccessRedirect('/admin/');
var app = express.createServer(
express.bodyParser(),
express.static(__dirname + "/public"),
express.cookieParser(),
express.session({ secret: 'htuayreve'}),
everyauth.middleware()
);
app.configure( function () {
app.set('view engine', 'jade');
});
app.get('/', function (req, res) {
res.render('templates/default/index', {
title: 'blogab',
users: JSON.stringify(usersByLogin, null, 2)
});
});
app.get('/login', function (req, res) {
res.render('bcore/login', {
title: 'login',
users: JSON.stringify(usersByLogin, null, 2)
});
});
app.get('/admin/newpost', function (req, res) {
res.render('bcore/newpost', {
title: 'Blogab-newpost',
users: ';
JSON.stringify(usersByLogin, null, 2)
});
});
app.get('/admin/', function (req, res) {
res.render('bcore/admin', {
title: 'core',
users: JSON.stringify(usersByLogin, null, 2)
});
});
everyauth.helpExpress(app);
app.listen(1224, function(){
console.log("blogab is running on port %d in %s mode", app.address().port, app.settings.env);
});
何が間違っているのかわかりません。以前はリダイレクト URL が \ だったときに everyauth を使用していましたが、完全に機能していましたが、変更すると正しく機能しません。