Hookup 2nd stage email registration; not finished as we aren't storing u/p
This commit is contained in:
parent
8d7d338f44
commit
7568a3b2d3
2 changed files with 52 additions and 0 deletions
|
@ -234,6 +234,29 @@ class Register extends Signup {
|
|||
}
|
||||
}
|
||||
|
||||
recheckState() {
|
||||
// feels a bit wrong to be clobbering the global client for something we
|
||||
// don't even know if it'll work, but we'll leave this here for now to
|
||||
// not complicate matters further. It would be nicer to isolate this
|
||||
// logic entirely from the rest of the app though.
|
||||
MatrixClientPeg.replaceUsingUrls(
|
||||
this._hsUrl,
|
||||
this._isUrl
|
||||
);
|
||||
// We've been given a bunch of data from a previous register step,
|
||||
// this only happens for email auth currently. It's kinda ming we need
|
||||
// to know this though. A better solution would be to ask the stages if
|
||||
// they are ready to do something rather than accepting that we know about
|
||||
// email auth and its internals.
|
||||
this.params.hasEmailInfo = (
|
||||
this.params.clientSecret && this.params.sessionId && this.params.idSid
|
||||
);
|
||||
|
||||
if (this.params.hasEmailInfo) {
|
||||
this.startStage(EMAIL_STAGE_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
tellStage(stageName, data) {
|
||||
if (this.activeStage && this.activeStage.type === stageName) {
|
||||
console.log("Telling stage %s about something..", stageName);
|
||||
|
|
|
@ -105,7 +105,36 @@ class EmailIdentityStage extends Stage {
|
|||
super(EmailIdentityStage.TYPE, matrixClient, signupInstance);
|
||||
}
|
||||
|
||||
_completeVerify() {
|
||||
console.log("_completeVerify");
|
||||
var isLocation = document.createElement('a');
|
||||
isLocation.href = this.signupInstance.getIdentityServerUrl();
|
||||
|
||||
return q({
|
||||
auth: {
|
||||
type: 'm.login.email.identity',
|
||||
threepid_creds: {
|
||||
sid: this.signupInstance.params.idSid,
|
||||
client_secret: this.signupInstance.params.clientSecret,
|
||||
id_server: isLocation.host
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete the email stage.
|
||||
*
|
||||
* This is called twice under different circumstances:
|
||||
* 1) When requesting an email token from the IS
|
||||
* 2) When validating query parameters received from the link in the email
|
||||
*/
|
||||
complete() {
|
||||
console.log("Email complete()");
|
||||
if (this.signupInstance.params.hasEmailInfo) {
|
||||
return this._completeVerify();
|
||||
}
|
||||
|
||||
var config = {
|
||||
clientSecret: this.client.generateClientSecret(),
|
||||
sendAttempt: 1
|
||||
|
|
Loading…
Reference in a new issue