def _reset_password(self, identity): form = ResetPasswordForm() if form.validate_on_submit(): identity.password = form.password.data flash(_("Your password has been changed successfully."), 'success') login_user(identity.user, identity) # We usually come here from a multipass login page so we should have a target url return multipass.redirect_success() form.username.data = identity.identifier return WPAuth.render_template('reset_password.html', form=form, identity=identity, widget_attrs={'username': {'disabled': True}})