Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goblin username and password to config as well #27

Merged
merged 1 commit into from
Aug 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

var config = require('./config.js')

//check if client is logged in
exports.check = function authCheck(req, res, next) {
if (req.session.user) {
Expand All @@ -25,7 +28,7 @@ exports.check = function authCheck(req, res, next) {
//receives username and password throw http post request
exports.login = function (req, res) {
var post = req.body
if (post.username == 'admin' && post.password == 'admin') {
if (post.username == config.goblinUsername && post.password == config.goblinPassword) {
req.session.user = true
res.redirect('/gb-admin/edit')
} else {
Expand Down
10 changes: 8 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// All configurable fields in one location! How cool?
var config = exports = module.exports = {};

// Admin user name
// Goblin Admin user name
config.goblinUsername = "admin"

// Admin Password
// Goblin Admin password
config.goblinPassword = "admin"

// What Port you want goblin deployed on
config.desiredPort = 8000

// Couch Admin user name
config.couchUsername = "admin"

// Couch Admin Password
config.couchPassword = "admin"

// URL of the CouchDB instance
config.couchURL = "http://127.0.0.1"

Expand Down
4 changes: 2 additions & 2 deletions lib/couchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var cradle = require('cradle'),

var db = new(cradle.Connection)(config.couchURL, config.couchPort, {
auth: {
username: config.goblinUsername,
password: config.goblinPassword
username: config.couchUsername,
password: config.couchPassword
},
cache: false
}).database('goblin') //database name
Expand Down