Clarify required auth stages
parent
fb39ba1ffc
commit
ba50ef8445
|
@ -270,11 +270,15 @@ module.exports = React.createClass({
|
||||||
this.validateField(FIELD_USERNAME, ev.type);
|
this.validateField(FIELD_USERNAME, ev.type);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A step is required if all flows include that step.
|
||||||
|
*
|
||||||
|
* @param {string} step A stage name to check
|
||||||
|
* @returns {boolean} Whether it is required
|
||||||
|
*/
|
||||||
_authStepIsRequired(step) {
|
_authStepIsRequired(step) {
|
||||||
// A step is required if no flow exists which does not include that step
|
return this.props.flows.every((flow) => {
|
||||||
// (Notwithstanding setups like either email or msisdn being required)
|
return flow.stages.includes(step);
|
||||||
return !this.props.flows.some((flow) => {
|
|
||||||
return !flow.stages.includes(step);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue