- {siteView.site.require_application && (
- <>
- <div class="form-group row">
- <div class="offset-sm-2 col-sm-10">
- <div class="mt-2 alert alert-warning" role="alert">
- <Icon icon="alert-triangle" classes="icon-inline mr-2" />
- {i18n.t("fill_out_application")}
- </div>
- {siteView.site.application_question.match({
- some: question => (
- <div
- className="md-div"
- dangerouslySetInnerHTML={mdToHtml(question)}
- />
- ),
- none: <></>,
- })}
- </div>
- </div>
-
- <div class="form-group row">
- <label
- class="col-sm-2 col-form-label"
- htmlFor="application_answer"
- >
- {i18n.t("answer")}
- </label>
- <div class="col-sm-10">
- <MarkdownTextArea
- initialContent={None}
- placeholder={None}
- buttonTitle={None}
- maxLength={None}
- onContentChange={this.handleAnswerChange}
- hideNavigationWarnings
- />
- </div>
- </div>
- </>
- )}
-
- {this.state.captcha.isSome() && (
- <div class="form-group row">
- <label class="col-sm-2" htmlFor="register-captcha">
- <span class="mr-2">{i18n.t("enter_code")}</span>
- <button
- type="button"
- class="btn btn-secondary"
- onClick={linkEvent(this, this.handleRegenCaptcha)}
- aria-label={i18n.t("captcha")}
- >
- <Icon icon="refresh-cw" classes="icon-refresh-cw" />
- </button>
- </label>
- {this.showCaptcha()}
- <div class="col-sm-6">
- <input
- type="text"
- class="form-control"
- id="register-captcha"
- value={toUndefined(this.state.registerForm.captcha_answer)}
- onInput={linkEvent(
- this,
- this.handleRegisterCaptchaAnswerChange
- )}
- required
- />
- </div>
- </div>
- )}
- {siteView.site.enable_nsfw && (
- <div class="form-group row">
- <div class="col-sm-10">
- <div class="form-check">
- <input
- class="form-check-input"
- id="register-show-nsfw"
- type="checkbox"
- checked={this.state.registerForm.show_nsfw}
- onChange={linkEvent(
- this,
- this.handleRegisterShowNsfwChange
- )}
- />
- <label class="form-check-label" htmlFor="register-show-nsfw">
- {i18n.t("show_nsfw")}
- </label>
- </div>
- </div>
- </div>
- )}
- <input
- tabIndex={-1}
- autoComplete="false"
- name="a_password"
- type="text"
- class="form-control honeypot"
- id="register-honey"
- value={toUndefined(this.state.registerForm.honeypot)}
- onInput={linkEvent(this, this.handleHoneyPotChange)}
+ showCaptcha(res: GetCaptchaResponse) {
+ const captchaRes = res?.ok;
+ return captchaRes ? (
+ <div className="col-sm-4">
+ <>
+ <img
+ className="rounded-top img-fluid"
+ src={this.captchaPngSrc(captchaRes)}
+ style="border-bottom-right-radius: 0; border-bottom-left-radius: 0;"
+ alt={I18NextService.i18n.t("captcha")}