-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
🎨 deny auto switch #8086
🎨 deny auto switch #8086
Conversation
.then(function (count) { | ||
return !!count; | ||
}); | ||
return models.User.isSetup(); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
no issue - deny auth switch after the blog was setup - setup completed depends on the status of the user right now, see comments
ca3016f
to
877f6b0
Compare
Ready to review |
core/server/models/user.js
Outdated
* @TODO: see https://github.com/TryGhost/Ghost/issues/8003 | ||
*/ | ||
isSetup: function isSetup() { | ||
var validStatuses = ['active', 'warn-1', 'warn-2', 'warn-3', 'warn-4', 'locked']; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
core/server/auth/validation.js
Outdated
return Promise.reject(new errors.InternalServerError({ | ||
code: 'AUTH_SWITCH', | ||
message: 'Switching the auth strategy is not allowed.', | ||
context: 'Please reset your database and start from stretch.', |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
.then(function (count) { | ||
return !!count; | ||
}); | ||
return models.User.isSetup(); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -72,7 +72,11 @@ function init() { | |||
parentApp = require('./app')(); | |||
|
|||
debug('Express Apps done'); | |||
|
|||
}).then(function () { | |||
return auth.validation.switch({ |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
- re-use statuses in user model - update error message
Ready to merge 👍 Will push the refactoring PR tomorrow - working on something else right now. |
no issue
For now we deny the auth switch after blog setup.
I tested all kinds of edge cases e.g. user starts with a blog and switches auth strategies before setup has finished.