Commit Graph

92 Commits

Author SHA1 Message Date
Barış Soner Uşaklı
a227cbe328 refactor: async/await middleware 2019-12-16 08:44:55 -05:00
Baris Usakli
cec0079573 refactor: shorter returns 2019-11-15 14:27:45 -05:00
Baris Usakli
efd1e88bbf feat: convert middleware.isAdmin to async/await 2019-11-15 14:24:24 -05:00
Baris Usakli
1eca5b3dae fix: show login fields if user has local password 2019-11-15 13:19:29 -05:00
Opliko
b9583ed838 Add privilege for accessing user information (#7859)
* Add view users info global privilege

* Show user ip only to global mods and admins

* fix missing comma

* Hide link for users without correct privilege

* move getting privilege information to getAllData

* Hide the link from Global Moderators as well

* Give Global Moderator view:users:info privilege

* Restrict ip in post menu to view:users:info

* add some trailing commas....

* Add privilege to categories test

* Add group privilege to categories test

* add upgrade script

* fix style for TravisCI

* more styling - change spaces to tabs

* some more styling fixes (hopefully final one)

* fix style for Travis CI

* hide ip in chat messages

* Don't show even hidden ips on user profile page
2019-09-17 14:02:52 -04:00
Baris Usakli
8f55ab1340 fix: #7494 2019-03-26 12:24:28 -04:00
Julian Lam
949b10f132 fix: no relative path needed in req.session.returnTo
re: julianlam/nodebb-plugin-session-sharing#73
2019-02-15 16:42:11 -05:00
Barış Soner Uşaklı
c72da5595a fix: #6806
3 new global privileges
view:users
view:tags
view:groups
2019-02-05 12:08:18 -05:00
Julian Lam
a23854e3ff feat: new hook type: response
Used in authentication middleware. Instead of firing an action
hook, it now fires a response hook.

Response hooks are invoked serially, and if headers are sent from
one of the hook listeners, all subsequent hook methods are not
called.

Response hooks should only be used in situations where res.send
(or other like methods) are invoked. Existing plugin hooks that
pass in res purely for data retrieval purposes have not changed).

fixes nodebb/nodebb-plugin-write-api#101
2019-01-19 14:49:22 -05:00
Barış Soner Uşaklı
60390c01f1 fix: loop 2018-12-17 16:59:45 -05:00
Barış Soner Uşaklı
f88db22ca2 feat: give the rest of the middlewares names 2018-12-17 16:36:43 -05:00
Barış Soner Uşaklı
53793e1603 feat: give names to middlewares 2018-12-17 16:03:01 -05:00
Julian Lam
4fba1492c1 feat: added new middleware authenticateOrGuest 2018-12-07 13:31:31 -05:00
Barış Soner Uşaklı
e17c4b2766 uid fixes 2018-11-17 22:31:39 -05:00
Barış Soner Uşaklı
69bb3293ee misc fixes
handle spider uids properly
2018-11-12 00:20:44 -05:00
Barış Soner Uşaklı
9c022afae1 Parse int (#6853)
* Store config fields as JSON in the db

Fewer parseInts

* Remove unnecessary parseInts

* remove some dupe code add tests

* remove console.log

* remove more parseInts

* WIP: read meta.configs defaults from defaults.json

remove more parseInts

* more work

* add log for failing test

* update admin pwd

* fix tests, dont require posts/cache before configs are initialized

* handle saves

* Test boolean conditions

* remove more parseInts

* Fix boolean values

* remove lots more parseInts

* removed json parsing

* renamed var to number

* categories dont have timestamp
2018-10-21 16:47:51 -04:00
Julian Lam
ebabcc5e3c if authenticate middleware is overridden by plugin, check for req.user and return notAllowed helper otherwise
/cc @LudwikJaniuk
2018-09-27 13:46:16 -04:00
LudwikJaniuk
c7f3b76b4e DRY req props that depend on auth (fix #6727) (#6731)
* DRY req props that depend on auth (fix #6727)

authentication leads to req.loggedIn and req.uid being set. However, a
later authentication event might outdate them. Here, I create one
function for setting those properties, and make sure it also is called
on the `action:middleware.authenticate` hook, which would be such an
authentication event. If there are other places, those should be added
as well.

* fix lint errors

* fix lint error

* change exports
2018-09-04 09:43:33 -04:00
Julian Lam
7a53fa9469 Added block and unblock button to profile dropdown menu, #6560 2018-07-05 14:20:33 -04:00
Julian Lam
99f1a5380e closes #6483 2018-05-02 13:02:18 -04:00
Barış Soner Uşaklı
beadcd7857 fix tests, remove dupe exposeUid 2018-04-28 10:25:17 -04:00
Julian Lam
bfee23adee basic methods and initial integration for #6463 2018-04-20 12:20:48 -04:00
Barış Soner Uşaklı
ac1f7eefe5 closes #2304 2018-01-31 15:20:17 -05:00
Baris Usakli
c090ec301b fix lint 2018-01-25 12:31:43 -05:00
Barış Soner Uşaklı
f7aa32cd05 dont crash if res.session.meta is not set 2018-01-25 09:16:08 -05:00
Barış Soner Uşaklı
7c1f8891a1 use helper 2017-12-09 12:25:27 -05:00
Baris Usakli
2065f895d5 closes #6037 2017-11-17 15:26:36 -05:00
Peter Jaszkowiak
f5385e38bf Add /me* route which redirects to /user/[userslug]* (#6063)
* Add `/me*` route which redirects to the current user's information

- `/me` -> `/user/[usertslug]`
- `/me/bookmarks` -> `/user/[userslug]/bookmarks`
- `/me/settings` -> `/user/[userslug]/settings`

etc

* Add tests for `/me/*`
2017-11-16 17:38:26 -05:00
Baris Usakli
4ac8d29f06 closes #5847 2017-08-01 13:17:03 -04:00
Barış Soner Uşaklı
01e2263c01 more tests 2017-05-12 17:53:23 -04:00
Peter Jaszkowiak
09e868ce5f ESlint no-useless-escape, no-else-return 2017-02-18 14:27:26 -07:00
Peter Jaszkowiak
896c8c7343 ESlint object-curly-spacing 2017-02-18 12:30:49 -07:00
Peter Jaszkowiak
3b0dd2d1ef ESlint padded-blocks 2017-02-18 02:32:24 -07:00
Peter Jaszkowiak
604358ecc4 ESlint keyword-spacing, no-multi-spaces 2017-02-18 01:52:56 -07:00
Peter Jaszkowiak
bc1d70c126 ESlint comma-dangle 2017-02-17 19:31:21 -07:00
Julian Lam
2a9088d571 updating checkGlobalPrivacySettings middleware to hook into write-api for auth 2017-01-12 15:55:56 -05:00
barisusakli
2476ab3684 closes #5202 2016-11-15 12:45:07 +03:00
Sergii Paryzhskyi
e515b791da Fix eslint rules (#5117)
* Fix semi linter rule

* Fix semi-spacing linter rule

* Fix no-undef-init linter rule

* Fix space-before-blocks linter rule
2016-10-25 15:34:47 -04:00
barisusakli
a995afbfe0 fix style 2016-10-25 12:53:43 +03:00
Julian Lam
2463e85c0d allowing moderators access to the account info page 2016-10-24 15:58:57 -04:00
HeeL
4a3c31b2dc Fix space-before-function-paren linter rule 2016-10-13 11:43:39 +02:00
barisusakli
8f408faf46 organize middlewares
removed app.locals.middleware
middlewares can be required anywhere, ie in controllers
2016-08-26 18:50:37 +03:00