Skip to content
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

Merged
merged 2 commits into from
Mar 2, 2017
Merged

Conversation

kirrg001
Copy link
Contributor

@kirrg001 kirrg001 commented Mar 2, 2017

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.

.then(function (count) {
return !!count;
});
return models.User.isSetup();

This comment was marked as abuse.

This comment was marked as abuse.

@kirrg001 kirrg001 changed the title [WIP] 🎨 deny auto switch 🎨 deny auto switch Mar 2, 2017
@kirrg001 kirrg001 changed the title 🎨 deny auto switch [WIP] 🎨 deny auto switch Mar 2, 2017
no issue

- deny auth switch after the blog was setup
- setup completed depends on the status of the user right now, see comments
@kirrg001 kirrg001 changed the title [WIP] 🎨 deny auto switch 🎨 deny auto switch Mar 2, 2017
@kirrg001
Copy link
Contributor Author

kirrg001 commented Mar 2, 2017

Ready to review

* @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.

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.

.then(function (count) {
return !!count;
});
return models.User.isSetup();

This comment was marked as abuse.

@@ -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.

This comment was marked as abuse.

This comment was marked as abuse.

- re-use statuses in user model
- update error message
@kirrg001
Copy link
Contributor Author

kirrg001 commented Mar 2, 2017

Ready to merge 👍 Will push the refactoring PR tomorrow - working on something else right now.

@ErisDS ErisDS merged commit 9fafc38 into TryGhost:master Mar 2, 2017
@ErisDS ErisDS removed their assignment Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants