Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
edsu committed Mar 3, 2021
1 parent 3050cd1 commit 4d2705b
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 31 deletions.
2 changes: 1 addition & 1 deletion dist/archive/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="main-6613e4913d732009432c.js"></script></body>
<script type="text/javascript" src="main-7f2e565d97814be5dcdd.js"></script></body>
</html>
1 change: 0 additions & 1 deletion dist/archive/main-6613e4913d732009432c.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/archive/main-7f2e565d97814be5dcdd.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="/main-e7b081c34806c044fbe6.js"></script></body>
<script type="text/javascript" src="/main-2ed11e2461153c775e36.js"></script></body>
</html>

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions dist/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ app.get('/settings', /*#__PURE__*/function () {
case 2:
settings = _context3.sent;

if (!settings || !req.user) {
if (!req.user || !req.user.isSuperUser) {
delete settings.appKey;
delete settings.appSecret;
}

res.json(settings);
// if they aren't logged in or the they're not an admin
// be sure to delete the app key settings!
if (!req.user || req.user && !req.user.isSuperUser) {
delete settings.appKey;
delete settings.appSecret;
}

case 4:
res.json(settings);

case 5:
case "end":
return _context3.stop();
}
Expand Down
53 changes: 46 additions & 7 deletions dist/server/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

var _express = _interopRequireDefault(require("express"));

var _passport = _interopRequireDefault(require("passport"));
Expand All @@ -21,8 +25,9 @@ var activateKeys = function activateKeys() {
consumerSecret: settings.appSecret,
callbackURL: '/auth/twitter/callback',
proxy: true,
includeEmail: true
}, function (token, tokenSecret, profile, cb) {
includeEmail: true,
passReqToCallback: true
}, function (req, token, tokenSecret, profile, cb) {
db.getUserByTwitterUserId(profile.id).then(function (user) {
if (!user) {
var newUser = {
Expand Down Expand Up @@ -64,12 +69,46 @@ _passport["default"].deserializeUser(function (userId, done) {

app.use(_passport["default"].initialize());
app.use(_passport["default"].session());
app.get('/twitter', _passport["default"].authenticate('twitter'));
app.get('/twitter/callback', _passport["default"].authenticate('twitter', {
failureRedirect: '/login'
}), function (req, res) {
res.redirect('/profile/');
app.get('/twitter', function (req, res, next) {
_passport["default"].authenticate('twitter', function (err) {
if (err) {
return res.redirect("/settings/?error=".concat(encodeURIComponent(err.message)));
}
})(req, res, next);
});
app.get('/twitter/callback', _passport["default"].authenticate('twitter', {
failureRedirect: '/'
}), /*#__PURE__*/function () {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(req, res) {
var user;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return db.getUser(req.user);

case 2:
user = _context.sent;

if (user.active) {
res.redirect('/');
} else {
res.redirect('/profile/');
}

case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));

return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}());
app.get('/logout', function (req, res) {
req.logout();
res.redirect('/');
Expand Down

0 comments on commit 4d2705b

Please sign in to comment.