Ejemplo n.º 1
0
 def _on_claim_user_clicked(self, action_addr):
     ret = ClaimUserWidget.exec_modal(
         jobs_ctx=self.jobs_ctx, config=self.config, addr=action_addr, parent=self
     )
     if ret:
         self.reload_login_devices()
         self.try_login(ret[0], ret[1])
Ejemplo n.º 2
0
    def _on_claim_user_clicked(self, action_addr=None):
        if not action_addr:
            url = get_text_input(
                parent=self,
                title=_("TEXT_CLAIM_USER_URL_TITLE"),
                message=_("TEXT_CLAIM_USER_URL_INSTRUCTIONS"),
                placeholder=_("TEXT_CLAIM_USER_URL_PLACEHOLDER"),
            )
            if url is None:
                return
            elif url == "":
                show_error(self, _("TEXT_CLAIM_USER_INVALID_URL"))
                return

            action_addr = None
            try:
                action_addr = BackendOrganizationClaimUserAddr.from_url(url)
            except ValueError as exc:
                show_error(self, _("TEXT_CLAIM_USER_INVALID_URL"), exception=exc)
                return
        ret = ClaimUserWidget.exec_modal(
            jobs_ctx=self.jobs_ctx, config=self.config, addr=action_addr, parent=self
        )
        if ret:
            self.reload_login_devices()