web: fix linting errors

This commit is contained in:
Jens Langhammer 2021-02-20 19:59:24 +01:00
parent e0ae92ccc7
commit 8787dc23d0
3 changed files with 28 additions and 21 deletions

View File

@ -88,9 +88,9 @@ class TestFlowsEnroll(SeleniumTestCase):
self.driver.get(self.live_server_url) self.driver.get(self.live_server_url)
self.wait.until( self.wait.until(
ec.presence_of_element_located((By.CSS_SELECTOR, "[role=enroll]")) ec.presence_of_element_located((By.CSS_SELECTOR, "#enroll"))
) )
self.driver.find_element(By.CSS_SELECTOR, "[role=enroll]").click() self.driver.find_element(By.CSS_SELECTOR, "#enroll").click()
self.wait.until(ec.presence_of_element_located((By.ID, "id_username"))) self.wait.until(ec.presence_of_element_located((By.ID, "id_username")))
self.driver.find_element(By.ID, "id_username").send_keys("foo") self.driver.find_element(By.ID, "id_username").send_keys("foo")
@ -169,7 +169,7 @@ class TestFlowsEnroll(SeleniumTestCase):
FlowStageBinding.objects.create(target=flow, stage=user_login, order=4) FlowStageBinding.objects.create(target=flow, stage=user_login, order=4)
self.driver.get(self.live_server_url) self.driver.get(self.live_server_url)
self.driver.find_element(By.CSS_SELECTOR, "[role=enroll]").click() self.driver.find_element(By.CSS_SELECTOR, "#enroll").click()
self.driver.find_element(By.ID, "id_username").send_keys("foo") self.driver.find_element(By.ID, "id_username").send_keys("foo")
self.driver.find_element(By.ID, "id_password").send_keys(USER().username) self.driver.find_element(By.ID, "id_password").send_keys(USER().username)
self.driver.find_element(By.ID, "id_password_repeat").send_keys(USER().username) self.driver.find_element(By.ID, "id_password_repeat").send_keys(USER().username)

View File

@ -11,6 +11,9 @@ export interface IdentificationStageArgs {
application_pre?: string; application_pre?: string;
enroll_url?: string;
recovery_url?: string;
} }
export interface UILoginButton { export interface UILoginButton {
@ -47,6 +50,24 @@ export class IdentificationStage extends BaseStage {
</li>`; </li>`;
} }
renderFooter(): TemplateResult {
if (!(this.args?.enroll_url && this.args.recovery_url)) {
return html``;
}
return html`<div class="pf-c-login__main-footer-band">
${this.args.enroll_url ? html`
<p class="pf-c-login__main-footer-band-item">
${gettext("Need an account?")}
<a id="enroll" href="${this.args.enroll_url}">${gettext("Sign up.")}</a>
</p>` : html``}
${this.args.recovery_url ? html`
<p class="pf-c-login__main-footer-band-item">
${gettext("Need an account?")}
<a id="recovery" href="${this.args.recovery_url}">${gettext("Forgot username or password?")}</a>
</p>` : html``}
</div>`;
}
render(): TemplateResult { render(): TemplateResult {
if (!this.args) { if (!this.args) {
return html`<ak-loading-state></ak-loading-state>`; return html`<ak-loading-state></ak-loading-state>`;
@ -57,7 +78,7 @@ export class IdentificationStage extends BaseStage {
</h1> </h1>
</header> </header>
<div class="pf-c-login__main-body"> <div class="pf-c-login__main-body">
<form class="pf-c-form" @submit=${(e) => {this.submit(e)}}> <form class="pf-c-form" @submit=${(e) => {this.submit(e);}}>
${this.args.application_pre ? ${this.args.application_pre ?
html`<p> html`<p>
${gettext(`Login to continue to ${this.args.application_pre}.`)} ${gettext(`Login to continue to ${this.args.application_pre}.`)}
@ -85,22 +106,7 @@ export class IdentificationStage extends BaseStage {
return this.renderSource(source); return this.renderSource(source);
})} })}
</ul> </ul>
${this.renderFooter()}
<!--{% if enroll_url or recovery_url %}
<div class="pf-c-login__main-footer-band">
{% if enroll_url %}
<p class="pf-c-login__main-footer-band-item">
{% trans 'Need an account?' %}
<a role="enroll" href="{{ enroll_url }}">{% trans 'Sign up.' %}</a>
</p>
{% endif %}
{% if recovery_url %}
<p class="pf-c-login__main-footer-band-item">
<a role="recovery" href="{{ recovery_url }}">{% trans 'Forgot username or password?' %}</a>
</p>
{% endif %}
</div>
{% endif %}-->
</footer>`; </footer>`;
} }

View File

@ -14,7 +14,8 @@ enum ChallengeTypes {
interface Challenge { interface Challenge {
type: ChallengeTypes; type: ChallengeTypes;
args: { [key: string]: string }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
args: any;
component?: string; component?: string;
title?: string; title?: string;
} }