163 Commits (f9b248b87f3e950e819a0a2ad568d88efec18b4a)

Author SHA1 Message Date
Julian Lam 1d9cfe1e96 fix: bug where interstitial errors were not properly passed to the front-end via req.flash 4 years ago
Julian Lam 1fee6a702a fix: #9487, session data gathered during a session is lost upon login
e.g. returnTo, tids_viewed, etc.
4 years ago
Julian Lam 697ed3bf37 feat: roll session identifier on login, as security best practice
see: https://owasp.org/www-community/attacks/Session_fixation
4 years ago
Julian Lam e845c34b52 fix: registration interstitials not handling promise rejections properly 4 years ago
Julian Lam f65d2162f8 feat: update hook
Hook payload updated to pass login strategy (if overridden, this value will be something other than 'local'), and explicitly pass error if the login failed.
4 years ago
Julian Lam 98b72ca572 fix: allow local (and overridden) login strategies to pass Error objects back 4 years ago
Julian Lam f806befd2f fix: bug where loginSeconds setting was ignored for local login 4 years ago
Julian Lam 9bf94ad50f fix: allow interstitial callbacks to be functional (no cb required) 4 years ago
Julian Lam 9a9f366d3b feat: track login sessions for admin dashboard reporting 4 years ago
Julian Lam 020f0b8322 fix: session not persisting to database in some scenarios
In some edge cases (e.g. SSO plugin redirecting the user immediately), with modern browsers, the request is never "completed" for speed. This causes a condition where the session object never persists to the database, even though it has changed. This added line forces a db persist on a successful login.

Context: https://github.com/expressjs/session/pull/484
4 years ago
Julian Lam 504fd107c7 feat: track successful logins in analytics 4 years ago
Peter Jaszkowiak cc9d6fd08b chore: eslint max-len 4 years ago
Peter Jaszkowiak 23f212a4c0 chore: eslint prefer-destructuring 4 years ago
Peter Jaszkowiak dab3b23575 chore: eslint no-var, vars-on-top 4 years ago
Peter Jaszkowiak b56d9e12b5 chore: eslint prefer-arrow-callback 4 years ago
Peter Jaszkowiak 707b55b6a5 chore: eslint prefer-template 4 years ago
Julian Lam 4f97639009 feat: new hook `action:login.continue` 4 years ago
Julian Lam 67e3fb6498 fix: register returnTo logic to match login route
Login route saves the previous page by checking for the X-Return-To header. This header is automatically set by ajaxify.
Login takes this value and saves it to `req.session`.

Up until now, `/register` saved the previous URL in a hidden input, and redirected based on that value, but it occasionally conflicted with req.session.returnTo. It was also confusing because it did not match how login handled the values.

This commit updates the route handling so it works identically to `/login`.
4 years ago
gasoved 53e0d4d2e0 feat: banned-users group 4 years ago
Julian Lam 7419922040 fix: improper override of req.body.username in login logic 4 years ago
Julian Lam b820d23401 feat: new hook `filter:login.override`, deprecate `action:auth.overrideLogin` 4 years ago
Julian Lam a186ea0fe3 fix: registration completion overriding returnTo if it was already set 4 years ago
Julian Lam 280285cda9 feat: allow interstitial callbacks to be async functions [breaking]
This change is breaking in the sense that if you have written
interstitial callbacks before that are async functions _with_ a
callback, those are no longer allowed. You will not need to call
next() as that argument will no longer be passed in to async
functions.
4 years ago
Julian Lam 1cf0032d9f feat: allow override of local fns in login controller, 400 instead of 500 for wrong login type [breaking] 4 years ago
Julian Lam 6e5ec3f895 feat: automatically unban users in onSuccessfulLogin
This allows write API (and probably SSO login) to go through unimpeded if a user's ban has expired. Closes nodebb/nodebb-plugin-write-api#126
4 years ago
Julian Lam 6e2da9966e refactor: move plugin hook methods to plugin.hooks.* 4 years ago
gasoved 3ccebf112e
feat: invites regardless of registration type, invite privilege, groups to join on acceptance (#8786)
* feat: allow invites in normal registration mode + invite privilege

* feat: select groups to join from an invite

* test: check if groups from invitations have been joined

* fix: remove unused variable

* feat: write API versions of socket calls

* docs: openapi specs for the new routes

* test: iron out mongo redis difference

* refactor: move inviteGroups endpoint into write API

* refactor: use GET /api/v3/users/:uid/invites/groups

Instead of GET /api/v3/users/:uid/inviteGroups

* fix: no need for /api/v3 prefix when using api module

* fix: tests

* refactor: change POST /api/v3/users/invite

To POST /api/v3/users/:uid/invites

* refactor: make helpers.invite awaitable

* fix: restrict invite API to self-use only

* fix: move invite groups controller to write api, +tests

* fix: tests

Co-authored-by: Julian Lam <[email protected]>
4 years ago
Barış Soner Uşaklı 51b7eca119 fix: run every hour, dont show message if average_time is 0 4 years ago
Opliko 04f4429f72
Resolve #7514 - optional timer for registration queue (#8796)
* feat: #7514 Optional timer for registration queue

* feat: show minutes in average time

* fix: don't show total number of minutes

* feat: implement requested changes

* fix: just store minutes instead of milliseconds

* feat: set default values
4 years ago
Julian Lam 512f6de6de
feat: allow passwords with length > 73 characters (#8818)
* feat: allow passwords longer than 73 characters

Context: A bcrypt/blowfish limitation means that password length is capped at 72 characters. We can get around this without compromising on security
by hashing all incoming passwords with SHA512, and then sending that to bcrypt.

https://dropbox.tech/security/how-dropbox-securely-stores-your-passwords

* feat: add additional test for passwords > 73 chars

* fix: remove 'password-too-long' error message and all invocations

* test: added test to show that a super long password won't bring down NodeBB

* fix: remove debug log

* Revert "fix: remove 'password-too-long' error message and all invocations"

This reverts commit 1e312bf7ef7e119fa0f1bd3517d756ca013d5e79.

* fix: added back password length checks, but at 512 chars

As processing a large string still uses a lot of memory
4 years ago
Julian Lam c0f699e655 fix: disallow registration attempts with password length > 4096
This is a stopgap measure for v1.15.0
4 years ago
Barış Soner Uşaklı dc29f4dca2 refactor: switch to using slugify module 4 years ago
Barış Soner Uşaklı 5e5815f051 fix: #8515, fix login redirect on subfolder 5 years ago
Barış Soner Uşaklı 5781a2dc65
feat: fix session mismatch errors by clearing cookie on logout (#8338)
* feat: fix session mismatch errors by clearing cookie on logout

* feat: remove app.upateHeader

ported from 2.0

* feat: handle if user doesn't click button and just refreshes page
5 years ago
Barış Soner Uşaklı 8bf980cb63 fix: tests, handle no sessions 5 years ago
Julian Lam f2f6fbf15a fix: #8232, unresolvable session mismatch on register cancel 5 years ago
Barış Soner Uşaklı a5ef6b53b8 fix: admin relogin 5 years ago
Julian Lam 111ed802cf fix: onSuccessfulLogin not working
In scenarios where onSuccessfulLogin was not called in the SSO plugin,
core's calling of onSuccessfulLogin was prematurely returning, because
it was checking the wrong value.

This commit fixes the issue by checking a different value.
5 years ago
Barış Soner Uşaklı dec157d606 fix: #8085, fix cookie name 5 years ago
Baris Usakli 366ad5cd69 fix: #8050, fix redirect after registration 5 years ago
Julian Lam cf7e0cfd2d
feat: no more session cookie for guests (#7982)
* feat: no more session cookie for guests

* fix(tests): added additional tests and fixed the broken test
5 years ago
Julian Lam ddf3812cdc fix: passwords always expiring upon login 5 years ago
Barış Soner Uşaklı 75bcb0f484 fix: remove unused data from post/topic/user hashes 5 years ago
Aziz Khoury 94810fd637 feat: adding filter:login.check and loginFormEntry[] for the filter:login.build hook (#7861)
* adding filter:login.check and loginFormEntry[] for the filter:login.build hook, related to nodebb-plugin-spam-be-gone/issues/32

* do not exceed 50 lines per function

* [email protected]
5 years ago
Barış Soner Uşaklı b9105ef9c6 refactor: async/await controllers/authentication 6 years ago
Barış Soner Uşaklı 22f8011686 refactor: remove async from isPasswordValid, function is sync 6 years ago
Julian Lam 29f96b199c fix(style): requiring parens in block bodies 6 years ago
Julian Lam 0921230976 fix(style): updated code to follow new eslint recommendations
Squashed commit of the following:

commit f9ce878b269b3568f0d649309aae1af4dcfdfeef
Author: Julian Lam <[email protected]>
Date:   Tue Aug 13 14:30:46 2019 -0400

    fix(style): updated code to follow new eslint recommendations

commit 80dd370e413f22badb96ff2138e7991dfff6d836
Author: Julian Lam <[email protected]>
Date:   Tue Aug 13 14:14:58 2019 -0400

    fix(deps): update dependency sitemap to v4

    Squashed commit of the following:

    commit f4dd9cabb21e26fdc21f8413be822ea7c64251f8
    Author: Julian Lam <[email protected]>
    Date:   Tue Aug 13 11:33:05 2019 -0400

        fix: resolved breaking changes from sitemap v4 upgrade

    commit 9043415ee16dcc27a8dcc2e4479d1bc5e2d1b60e
    Merge: e3352b272 72590b346
    Author: Julian Lam <[email protected]>
    Date:   Tue Aug 13 11:09:55 2019 -0400

        Merge branch 'master' into renovate/sitemap-4.x

    commit e3352b272eb9400bdb00774973181397803765e4
    Author: Renovate Bot <[email protected]>
    Date:   Mon Aug 12 07:59:05 2019 +0000

        fix(deps): update dependency sitemap to v4

commit 8e3c0cdcae22acc32d352be8bb72d60e7502dbc5
Author: Renovate Bot <[email protected]>
Date:   Fri Aug 9 00:49:51 2019 +0000

    fix(deps): update dependency commander to v3

commit 2104449d38818f2fa4d44b3a58a0a168781acbfb
Author: Renovate Bot <[email protected]>
Date:   Tue Aug 13 15:00:27 2019 +0000

    fix(deps): update dependency mongodb to v3.3.0

commit d2937f446a21131c070ae5d0ff33d67cfe465b8c
Author: Barış Soner Uşaklı <[email protected]>
Date:   Tue Aug 13 10:36:48 2019 -0400

    feat: async/await admin/controllers

commit 1b97e8b199f960dc24e5722702f27499ae049914
Author: Misty (Bot) <[email protected]>
Date:   Tue Aug 13 09:28:39 2019 +0000

    Latest translations and fallbacks

commit 69a48957a2f0d23c4d194b664bda3a0431179c01
Author: Barış Soner Uşaklı <[email protected]>
Date:   Mon Aug 12 21:56:09 2019 -0400

    feat: async/await

commit b9b2a7e593a452de4bef6d0ab6abe368a3bdb8dd
Author: Barış Soner Uşaklı <[email protected]>
Date:   Mon Aug 12 20:58:29 2019 -0400

    feat: async/await refactor

    controllers/accounts

commit a8d43a175974a0c8ae3dc132bf51a7ed9a4c6305
Author: Baris Usakli <[email protected]>
Date:   Mon Aug 12 14:49:40 2019 -0400

    feat: async/await controllers/accounts

commit 2f25aae57bf9dbe98d655276770e56bed9ec023b
Author: Barış Soner Uşaklı <[email protected]>
Date:   Sun Aug 11 23:09:50 2019 -0400

    fix: #7831, fix pagination

    convert to async/await

commit c9e83f2374572264855a04156278eef256b0a20c
Author: Barış Soner Uşaklı <[email protected]>
Date:   Sun Aug 11 00:14:35 2019 -0400

    fix: remove empty line

commit 30be91b26c4dd7583412c4e8d56e9c1688e48a44
Author: Barış Soner Uşaklı <[email protected]>
Date:   Sun Aug 11 00:13:41 2019 -0400

    fix: remove useless catchs and empty line

commit 2e4a71c0b6104738f15ffbfe3246105b922fdfb3
Author: Renovate Bot <[email protected]>
Date:   Sat Aug 10 06:51:50 2019 +0000

    chore(deps): update dependency eslint-config-airbnb-base to v14
6 years ago
Julian Lam 603c526287 fix: bad usage of async requisition 6 years ago
Julian Lam f321b426b1 fix: 7638, returnTo accidentally saved into user hash 6 years ago