(self)
return form
Process reset password form
Process reset password form
Process reset password form
def reset_password(self):
        """Process reset password form"""
        user = None
        token = request.query.get("token")
        if token:
            query = self.auth._query_from_token(token)
            user = self.auth.db(query).select().first()
            if not user:
                raise HTTP(404)
        form = Form(
            [
                Field(
                    "new_password",
                    type="password",
                    requires=self.auth.db.auth_user.password.requires,
                    label=self.auth.param.messages["labels"].get("new_password"),
                ),
                Field(
                    "new_password_again",
                    type="password",
                    requires=IS_EQUAL_TO(request.forms.get("new_password")),
                    label=self.auth.param.messages["labels"].get("password_again"),
                ),
            ],
            formstyle=self.formstyle,
            submit_value=self.auth.param.messages["buttons"]["submit"],
        )
        self._process_change_password_form(form, user, False)
        if form.accepted:
            self._set_flash("password-changed")
            self._postprocessing("reset_password", form, user)
        return form
def reset_password ( self ) : user = None token = request . query . get ( "token" ) if token : query = self . auth . _query_from_token ( token ) user = self . auth . db ( query ) . select ( ) . first ( ) if not user : raise HTTP ( 404 ) form = Form ( [ Field ( "new_password" , type = "password" , requires = self . auth . db . auth_user . password . requires , label = self . auth . param . messages [ "labels" ] . get ( "new_password" ) , ) , Field ( "new_password_again" , type = "password" , requires = IS_EQUAL_TO ( request . forms . get ( "new_password" ) ) , label = self . auth . param . messages [ "labels" ] . get ( "password_again" ) , ) , ] , formstyle = self . formstyle , submit_value = self . auth . param . messages [ "buttons" ] [ "submit" ] , ) self . _process_change_password_form ( form , user , False ) if form . accepted : self . _set_flash ( "password-changed" ) self . _postprocessing ( "reset_password" , form , user ) return form