@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515limitations under the License.
1616*/
1717
18- import { createClient } from 'matrix-js-sdk/src/matrix' ;
18+ import { createClient , IRequestTokenResponse , MatrixClient } from 'matrix-js-sdk/src/matrix' ;
1919import { _t } from './languageHandler' ;
2020
2121/**
@@ -26,12 +26,18 @@ import { _t } from './languageHandler';
2626 * API on the homeserver in question with the new password.
2727 */
2828export default class PasswordReset {
29+ private client : MatrixClient ;
30+ private clientSecret : string ;
31+ private identityServerDomain : string ;
32+ private password : string ;
33+ private sessionId : string ;
34+
2935 /**
3036 * Configure the endpoints for password resetting.
3137 * @param {string } homeserverUrl The URL to the HS which has the account to reset.
3238 * @param {string } identityUrl The URL to the IS which has linked the email -> mxid mapping.
3339 */
34- constructor ( homeserverUrl , identityUrl ) {
40+ constructor ( homeserverUrl : string , identityUrl : string ) {
3541 this . client = createClient ( {
3642 baseUrl : homeserverUrl ,
3743 idBaseUrl : identityUrl ,
@@ -47,7 +53,7 @@ export default class PasswordReset {
4753 * @param {string } newPassword The new password for the account.
4854 * @return {Promise } Resolves when the email has been sent. Then call checkEmailLinkClicked().
4955 */
50- resetPassword ( emailAddress , newPassword ) {
56+ public resetPassword ( emailAddress , newPassword ) : Promise < IRequestTokenResponse > {
5157 this . password = newPassword ;
5258 return this . client . requestPasswordEmailToken ( emailAddress , this . clientSecret , 1 ) . then ( ( res ) => {
5359 this . sessionId = res . sid ;
@@ -69,7 +75,7 @@ export default class PasswordReset {
6975 * with a "message" property which contains a human-readable message detailing why
7076 * the reset failed, e.g. "There is no mapped matrix user ID for the given email address".
7177 */
72- async checkEmailLinkClicked ( ) {
78+ public async checkEmailLinkClicked ( ) : Promise < void > {
7379 const creds = {
7480 sid : this . sessionId ,
7581 client_secret : this . clientSecret ,
0 commit comments