-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Don't allow enforcing 2FA when no provider is enabled #16463
Conversation
Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
} | ||
} | ||
|
||
export const actions = { | ||
const actions = { | ||
save ({commit}, ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird?
} | ||
|
||
export default new Vuex.Store({ | ||
export default { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner!! 👍
OCP.InitialState.loadState('settings', 'mandatory2FAState') | ||
) | ||
let initialState = OCP.InitialState.loadState('settings', 'mandatory2FAState'); | ||
store.commit('setEnforced', initialState.enforced); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is considered bad practice to commit from a component.
You need to use actions for that.
}, | ||
set: function (val) { | ||
this.dirty = true | ||
this.$store.commit('setExcludedGroups', val) | ||
} | ||
}, | ||
noProviderGlobally: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly use the function if you don't have a setter here.
noProviderGlobally: { | |
noProviderGlobally() { | |
var providers = this.$store.getters.getAllApps.filter( function(app) { | |
return ('two-factor-providers' in app && 'provider' in app['two-factor-providers'] && app['active'] === true); | |
}); | |
return (providers.length === 0); | |
} |
@@ -78,6 +84,10 @@ | |||
components: { | |||
Multiselect | |||
}, | |||
beforeMount(){ | |||
this.$store.dispatch('getAllApps'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading state here?
beforeMount(){ | ||
this.$store.dispatch('getAllApps'); | ||
this.$store.dispatch('getEnabledProvidersCurrentUser'); | ||
}, | ||
data () { | ||
return { | ||
loading: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so maybe set it to true by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments :)
Feel free to take over - I just untangled the git history. |
I'm going to close this due to lack of activity. |
Resubmit of #13735
Fixes #12267
I haven't committed compiled assets yet.
cc @rummatee