Skip to content

Commit

Permalink
Merge pull request #1 from ageg/master
Browse files Browse the repository at this point in the history
Modifications infra
  • Loading branch information
larryenvacances authored Jan 15, 2017
2 parents 8edbd03 + dd6329c commit 6d27fef
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 32 deletions.
21 changes: 18 additions & 3 deletions app/pages-admin/user-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,24 @@ const AdminUserList = React.createClass({
return a.dispatchEvent(e);
},

exportToCSV() {
let csv = "cip,nom,courriel,points,isPromocard,isAdmin\n";
generateListWithSeparator(s) {
let content = `cip${s}nom${s}courriel${s}points${s}isPromocard${s}isAdmin\n`;
for(let user of this.state.users) {
csv += `${user.cip},${user.name},${user.email},${user.totalPoints},${user.promocard && user.promocard.date ? "true": "false"},${user.isAdmin}\n`;
content += `${user.cip}${s}${user.name}${s}${user.email}${s}${user.totalPoints}${s}${user.promocard && user.promocard.date ? "true": "false"}${s}${user.isAdmin}\n`;
}

return content;
},

exportToSSV() {
const ssv = this.generateListWithSeparator(',');

this.download(ssv, 'pointsgenie.ssv', 'text/ssv');
},

exportToCSV() {
const csv = this.generateListWithSeparator(';');

this.download(csv, 'pointsgenie.csv', 'text/csv');
},

Expand All @@ -137,6 +149,9 @@ const AdminUserList = React.createClass({
<div className="col col-md-2 pull-right">
<Button onClick={this.exportToCSV} bsStyle="success">Export to CSV</Button>
</div>
<div className="col col-md-2 pull-right">
<Button onClick={this.exportToSSV} bsStyle="success">Export to SSV</Button>
</div>
</div>
<SearchBar ref="searchBar" filterText={this.state.filterText} onChange={this.handleFilterChange} />
<UserTable users={this.getFilteredUsers()}
Expand Down
11 changes: 10 additions & 1 deletion config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ var specific = {
mongo: {
url: "mongodb://localhost/pointsgenie_dev",
},
cas: {
proxyUrl: 'localhost:3000',
},
},
test: {
app: {
Expand All @@ -44,6 +47,9 @@ var specific = {
username: "dummy",
password: "dummy",
},
cas: {
proxyUrl: 'dummy',
},
},
production: {
app: {
Expand All @@ -54,7 +60,10 @@ var specific = {
},
mongo: {
url: "mongodb://localhost/pointsgenie",
}
},
cas: {
proxyUrl: process.env.CAS_PROXY_URL || 'promo59.ageg.ca',
},
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/bcrypt-thunk.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bcrypt from "bcrypt";
import bcrypt from "bcryptjs";

// These do not need to be promisified
module.exports.genSaltSync = bcrypt.genSaltSync;
Expand Down
3 changes: 2 additions & 1 deletion lib/cas-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var util = require("util");
var _ = require("lodash");
var xml2js = require("xml2js").parseString;
var request = require("superagent");
var config = require('../config/config');

function defaultExtract (body) {
if(body["cas:serviceResponse"] && body["cas:serviceResponse"]["cas:authenticationSuccess"]) {
Expand Down Expand Up @@ -47,7 +48,7 @@ CASStrategy.prototype.authenticate = function (req, options) {
_.merge(this._options, options);
var self = this;
var protocol = getProtocol(req);
var proxyUrl = "localhost:3000"; // TODO : Do it better
var proxyUrl = config.cas.proxyUrl;
// If it's the cas provider callback
if(req.query && req.query[this._options.cas.parameters.ticket]) {
var url = self._options.baseUrl + self._options.cas.urls.validate
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "points-genie",
"private": "true",
"version": "0.7.3",
"version": "0.8.0",
"description": "Site des points genie promo 57 UdeS",
"keywords": [
"udes",
Expand All @@ -13,12 +13,12 @@
"url": "https://github.com/carapas/pointsgenie.git"
},
"scripts": {
"start": "NODE_ENV=development nodemon --harmony server.js",
"wstart": "set NODE_ENV=development&& nodemon --harmony server.js",
"start": "NODE_ENV=development nodemon server.js",
"wstart": "set NODE_ENV=development&& nodemon server.js",
"test": "npm run build && npm run test-no-build -- --reporter dot",
"test-no-build": "NODE_ENV=test ./node_modules/.bin/mocha --harmony --reporter spec ./test/test-*.js",
"wtest-no-build": "set NODE_ENV=test&& call node_modules/.bin/mocha.cmd --harmony --reporter spec test/test-*.js",
"hot-dev-server": "webpack-dev-server --harmony --content-base public -ds --config webpack.config.js --hot --progress --colors --port 2992 --inline",
"test-no-build": "NODE_ENV=test ./node_modules/.bin/mocha --reporter spec ./test/test-*.js",
"wtest-no-build": "set NODE_ENV=test&& call node_modules/.bin/mocha.cmd --reporter spec test/test-*.js",
"hot-dev-server": "webpack-dev-server --content-base public -ds --config webpack.config.js --hot --progress --colors --port 2992 --inline",
"build": "NODE_ENV=production ./node_modules/.bin/webpack --config webpack.config.js --separate-stylesheet --optimize-minimize --progress --profile --colors --bail",
"wbuild": "set NODE_ENV=production&& webpack --config webpack.config.js --separate-stylesheet --optimize-minimize --progress --profile --colors --bail"
},
Expand All @@ -29,13 +29,23 @@
"iojs": ">=1.6.0"
},
"dependencies": {
"bcrypt": "~0.8.2",
"async": "0.9.x",
"babel": "~5.8.23",
"babel-core": "~5.8.23",
"babel-loader": "~5.3.2",
"babel-runtime": "~5.8.20",
"bcryptjs": "^2.4.0",
"bootstrap": "~3.3.4",
"classnames": "~1.2.1",
"co": "~4.5.2",
"co-views": "0.3.x",
"css-loader": "~0.12.0",
"extract-text-webpack-plugin": "~0.6.0",
"file-loader": "~0.8.1",
"flummox": "dozoisch/flummox#MountedCheck",
"git-rev": "0.2.x",
"glob": "~5.0.5",
"json-loader": "~0.5.1",
"koa": "~0.19.1",
"koa-bodyparser": "~1.6.0",
"koa-compress": "1.0.x",
Expand All @@ -49,41 +59,31 @@
"koa-sess-mongo-store": "0.1.x",
"koa-static-cache": "~3.1.0",
"ldapjs": "mcavage/node-ldapjs#6f5838768873016877863d12f5ee0ff7192ac255",
"less": "~2.5.0",
"less-loader": "~2.2.0",
"lodash": "~3.8.0",
"mocha": "~2.2.4",
"mongoose": "~4.1.5",
"nodemon": "~1.3.7",
"null-loader": "~0.1.1",
"passport-local": "1.0.x",
"passport-strategy": "1.0.x",
"pikaday": "~1.3.2",
"react": "~0.13.2",
"react-bootstrap": "~0.21.2",
"react-hot-loader": "~1.2.6",
"react-router": "dozoisch/react-router#2e375e94033e1cab5ed5b922395a79e368bb1929",
"react-router-bootstrap": "~0.13.0",
"react-select": "~0.6.0",
"superagent": "~1.2.0",
"swig": "1.4.x",
"xml2js": "0.4.x",
"async": "0.9.x",
"babel": "~5.8.23",
"babel-core": "~5.8.23",
"babel-loader": "~5.3.2",
"babel-runtime": "~5.8.20",
"bootstrap": "~3.3.4",
"css-loader": "~0.12.0",
"extract-text-webpack-plugin": "~0.6.0",
"file-loader": "~0.8.1",
"json-loader": "~0.5.1",
"less": "~2.5.0",
"less-loader": "~2.2.0",
"mocha": "~2.2.4",
"nodemon": "~1.3.7",
"null-loader": "~0.1.1",
"react-hot-loader": "~1.2.6",
"should": "~6.0.1",
"style-loader": "~0.12.1",
"superagent": "~1.2.0",
"supertest": "0.15.x",
"swig": "1.4.x",
"url-loader": "~0.5.5",
"webpack": "~1.10.1",
"webpack-dev-server": "~1.10.1",
"xml2js": "0.4.x",
"yargs": "~3.8.0"
}
}

0 comments on commit 6d27fef

Please sign in to comment.