web: make user password-reset button use action button

This commit is contained in:
Jens Langhammer 2021-03-01 20:33:00 +01:00
parent c65b2944b3
commit 3045cf1aef
5 changed files with 11 additions and 13 deletions

View File

@ -127,7 +127,5 @@ class UserPasswordResetView(LoginRequiredMixin, PermissionRequiredMixin, DetailV
link = request.build_absolute_uri( link = request.build_absolute_uri(
reverse_lazy("authentik_flows:default-recovery") + f"?{querystring}" reverse_lazy("authentik_flows:default-recovery") + f"?{querystring}"
) )
messages.success( messages.success(request, _("Password reset link: %(link)s" % {"link": link}))
request, _("Password reset link: <pre>%(link)s</pre>" % {"link": link})
)
return redirect("/") return redirect("/")

View File

@ -31,7 +31,6 @@ export class ActionButton extends SpinnerButton {
} }
return r; return r;
}) })
.then((r) => r.json())
.then(() => { .then(() => {
this.setDone(SUCCESS_CLASS); this.setDone(SUCCESS_CLASS);
}) })

View File

@ -20,7 +20,7 @@ export class Message extends LitElement {
message?: APIMessage; message?: APIMessage;
@property({type: Number}) @property({type: Number})
removeAfter = 3000; removeAfter = 8000;
@property({attribute: false}) @property({attribute: false})
onRemove?: (m: APIMessage) => void; onRemove?: (m: APIMessage) => void;

View File

@ -92,14 +92,14 @@ export class MessageContainer extends LitElement {
render(): TemplateResult { render(): TemplateResult {
return html`<ul class="pf-c-alert-group pf-m-toast"> return html`<ul class="pf-c-alert-group pf-m-toast">
${this.messages.map((m) => { ${this.messages.map((m) => {
return html`<ak-message return html`<ak-message
.message=${m} .message=${m}
.onRemove=${(m: APIMessage) => { .onRemove=${(m: APIMessage) => {
this.messages = this.messages.filter((v) => v !== m); this.messages = this.messages.filter((v) => v !== m);
this.requestUpdate(); this.requestUpdate();
}}> }}>
</ak-message>`; </ak-message>`;
})} })}
</ul>`; </ul>`;
} }
} }

View File

@ -5,6 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/ActionButton";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { User } from "../../api/Users"; import { User } from "../../api/Users";
@ -90,9 +91,9 @@ export class UserListPage extends TablePage<User> {
</li> </li>
</ul> </ul>
</ak-dropdown> </ak-dropdown>
<a class="pf-c-button pf-m-tertiary" href="${User.adminUrl(`${item.pk}/reset/`)}"> <ak-action-button method="GET" url="${User.adminUrl(`${item.pk}/reset/`)}">
${gettext("Reset Password")} ${gettext("Reset Password")}
</a> </ak-action-button>
<a class="pf-c-button pf-m-tertiary" href="${`-/impersonation/${item.pk}/`}"> <a class="pf-c-button pf-m-tertiary" href="${`-/impersonation/${item.pk}/`}">
${gettext("Impersonate")} ${gettext("Impersonate")}
</a>`, </a>`,