Merge pull request #4600 from matrix-org/dbkr/fix_email_sent_to_blank
Make email auth component fail better if server claims email isn't validatedpull/21833/head
commit
07eed94b35
|
@ -243,10 +243,15 @@ export default createReactClass({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await this._makeRegisterRequest({});
|
// We do the first registration request ourselves to discover whether we need to
|
||||||
// This should never succeed since we specified an empty
|
// do SSO instead. If we've already started the UI Auth process though, we don't
|
||||||
// auth object.
|
// need to.
|
||||||
console.log("Expecting 401 from register request but got success!");
|
if (!this.state.doingUIAuth) {
|
||||||
|
await this._makeRegisterRequest({});
|
||||||
|
// This should never succeed since we specified an empty
|
||||||
|
// auth object.
|
||||||
|
console.log("Expecting 401 from register request but got success!");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.httpStatus === 401) {
|
if (e.httpStatus === 401) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -412,14 +412,14 @@ export const EmailIdentityAuthEntry = createReactClass({
|
||||||
this.props.onPhaseChange(DEFAULT_PHASE);
|
this.props.onPhaseChange(DEFAULT_PHASE);
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
|
||||||
return {
|
|
||||||
requestingToken: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
if (this.state.requestingToken) {
|
// This component is now only displayed once the token has been requested,
|
||||||
|
// so we know the email has been sent. It can also get loaded after the user
|
||||||
|
// has clicked the validation link if the server takes a while to propagate
|
||||||
|
// the validation internally. If we're in the session spawned from clicking
|
||||||
|
// the validation link, we won't know the email address, so if we don't have it,
|
||||||
|
// assume that the link has been clicked and the server will realise when we poll.
|
||||||
|
if (this.props.inputs.emailAddress === undefined) {
|
||||||
const Loader = sdk.getComponent("elements.Spinner");
|
const Loader = sdk.getComponent("elements.Spinner");
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue