mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 14:49:07 +08:00
UX: hide associate accounts if second factor is enabled
Once second factor is enabled all login via associated accounts is banned showing this section just leads to confusion
This commit is contained in:
parent
155eb02c7e
commit
3748d3e281
|
@ -87,8 +87,12 @@ export default Ember.Controller.extend(
|
|||
return userId !== this.get("currentUser.id");
|
||||
},
|
||||
|
||||
@computed()
|
||||
canUpdateAssociatedAccounts() {
|
||||
@computed("model.second_factor_enabled")
|
||||
canUpdateAssociatedAccounts(secondFactorEnabled) {
|
||||
if (secondFactorEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
findAll(this.siteSettings, this.capabilities, this.site.isMobileDevice)
|
||||
.length > 0
|
||||
|
|
21
test/javascripts/controllers/preferences-account-test.js.es6
Normal file
21
test/javascripts/controllers/preferences-account-test.js.es6
Normal file
|
@ -0,0 +1,21 @@
|
|||
moduleFor("controller:preferences/account");
|
||||
|
||||
QUnit.test("updating of associated accounts", function(assert) {
|
||||
const controller = this.subject({
|
||||
siteSettings: {
|
||||
enable_google_oauth2_logins: true
|
||||
},
|
||||
model: Em.Object.create({
|
||||
second_factor_enabled: true
|
||||
}),
|
||||
site: Em.Object.create({
|
||||
isMobileDevice: false
|
||||
})
|
||||
});
|
||||
|
||||
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
||||
|
||||
controller.set("model.second_factor_enabled", false);
|
||||
|
||||
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
|
||||
});
|
Loading…
Reference in New Issue
Block a user