in fxa/core.py [0:0]
def reset_account(self, email, token, password=None, stretchpwd=None):
# TODO: Add support for recovery key!
exactly_one_of(password, "password", stretchpwd, "stretchpwd")
body = None
if self.key_stretch_version == 2:
version, salt = self.get_key_stretch_version(email)
if version == 2:
spwd = StretchedPassword(2, email, salt, password, stretchpwd)
# Note, without recovery key, we must generate new kb
kb = token_bytes(32)
body = {
"email": email,
"authPW": spwd.get_auth_pw_v1(),
"wrapKb": spwd.get_wrapkb_v1(kb),
"authPWVersion2": spwd.get_auth_pw_v2(),
"wrapKbVersion2": spwd.get_wrapkb_v2(kb),
"clientSalt": salt,
}
if body is None:
spwd = StretchedPassword(1, email, None, password, stretchpwd)
body = {
"authPW": spwd.get_auth_pw_v1(),
}
url = "/account/reset"
auth = HawkTokenAuth(token, "accountResetToken", self.apiclient)
self.apiclient.post(url, body, auth=auth)