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

UI/mfa small cleanup #15549

Merged
merged 6 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/app/adapters/mfa-login-enforcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter {
}).then(() => data);
}
// create does not return response similar to PUT request
async createRecord() {
createRecord() {
return this._saveRecord(...arguments);
}
// update record via POST method
updateRecord() {
return this._saveRecord(...arguments);
}

async query(store, type, query) {
query(store, type, query) {
const url = this.urlForQuery(query, type.modelName);
return this.ajax(url, 'GET', { data: { list: true } });
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/auth-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class AuthInfoComponent extends Component {
get hasEntityId() {
// root users will not have an entity_id because they are not associated with an entity.
// in order to use the MFA end user setup they need an entity_id
return this.auth.authData.entity_id ? true : false;
return !!this.auth.authData.entity_id;
}

get isRenewing() {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/serializers/mfa-login-enforcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ApplicationSerializer from './application';
export default class MfaLoginEnforcementSerializer extends ApplicationSerializer {
primaryKey = 'name';

// change keys for hasMany relationships with ids in the name
// Return data with updated keys for hasMany relationships with ids in the name
transformHasManyKeys(data, destination) {
const keys = {
model: ['mfa_methods', 'identity_entities', 'identity_groups'],
Expand All @@ -13,6 +13,7 @@ export default class MfaLoginEnforcementSerializer extends ApplicationSerializer
const oldKey = destination === 'model' ? keys.server[index] : keys.model[index];
delete Object.assign(data, { [newKey]: data[oldKey] })[oldKey];
});
return data;
}
normalize(model, data) {
this.transformHasManyKeys(data, 'model');
Expand All @@ -30,7 +31,6 @@ export default class MfaLoginEnforcementSerializer extends ApplicationSerializer
}
serialize() {
const json = super.serialize(...arguments);
this.transformHasManyKeys(json, 'server');
return json;
return this.transformHasManyKeys(json, 'server');
}
}
6 changes: 3 additions & 3 deletions ui/app/styles/components/radio-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
opacity: 0;
}

input[type='radio'] + label {
input[type='radio'] + span.dot {
border: 1px solid $grey-light;
border-radius: 50%;
cursor: pointer;
Expand All @@ -30,12 +30,12 @@
flex-grow: 0;
}

input[type='radio']:checked + label {
input[type='radio']:checked + span.dot {
background: $blue;
border: 1px solid $blue;
box-shadow: inset 0 0 0 0.15rem $white;
}
input[type='radio']:focus + label {
input[type='radio']:focus + span.dot {
box-shadow: 0 0 10px 1px rgba($blue, 0.4), inset 0 0 0 0.15rem $white;
}

Expand Down
6 changes: 3 additions & 3 deletions ui/app/templates/components/radio-card.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<label
for={{@value}}
for={{dasherize @value}}
class="radio-card {{if (eq @value @groupValue) 'is-selected'}} {{if @disabled 'is-disabled'}}"
...attributes
>
Expand All @@ -22,14 +22,14 @@
{{/if}}
<div class="radio-card-radio-row">
<RadioButton
id={{@value}}
id={{dasherize @value}}
name="config-mode"
class="radio"
disabled={{@disabled}}
@value={{@value}}
@groupValue={{@groupValue}}
@onChange={{@onChange}}
/>
<label for="radio-card-button"></label>
<span class="dot"></span>
</div>
</label>