stages/authenticator_validate: fix post from code form
This commit is contained in:
parent
2a0f940a42
commit
007676b400
|
@ -34,15 +34,13 @@ class AuthenticatorChallenge(WithUserInfoChallenge):
|
||||||
device_challenges = ListField(child=DeviceChallenge())
|
device_challenges = ListField(child=DeviceChallenge())
|
||||||
|
|
||||||
|
|
||||||
class AuthenticatorChallengeResponse(ChallengeResponse):
|
class AuthenticatorChallengeResponse(ChallengeResponse, DeviceChallenge):
|
||||||
"""Challenge used for Code-based authenticators"""
|
"""Challenge used for Code-based authenticators"""
|
||||||
|
|
||||||
response = DeviceChallenge()
|
|
||||||
|
|
||||||
request: HttpRequest
|
request: HttpRequest
|
||||||
user: User
|
user: User
|
||||||
|
|
||||||
def validate_response(self, value: DeviceChallenge):
|
def validate_challenge(self, value: dict):
|
||||||
"""Validate response"""
|
"""Validate response"""
|
||||||
return validate_challenge(value, self.request, self.user)
|
return validate_challenge(value, self.request, self.user)
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ export class AuthenticatorValidateStageWebCode extends BaseStage {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" name="device_class" value=${this.deviceChallenge?.device_class}>
|
||||||
|
<input type="hidden" name="device_uid" value=${this.deviceChallenge?.device_uid}>
|
||||||
|
|
||||||
<ak-form-element
|
<ak-form-element
|
||||||
label="${gettext("Code")}"
|
label="${gettext("Code")}"
|
||||||
|
@ -41,7 +43,7 @@ export class AuthenticatorValidateStageWebCode extends BaseStage {
|
||||||
.errors=${(this.challenge?.response_errors || {})["code"]}>
|
.errors=${(this.challenge?.response_errors || {})["code"]}>
|
||||||
<!-- @ts-ignore -->
|
<!-- @ts-ignore -->
|
||||||
<input type="text"
|
<input type="text"
|
||||||
name="code"
|
name="challenge"
|
||||||
inputmode="numeric"
|
inputmode="numeric"
|
||||||
pattern="[0-9]*"
|
pattern="[0-9]*"
|
||||||
placeholder="${gettext("Please enter your TOTP Code")}"
|
placeholder="${gettext("Please enter your TOTP Code")}"
|
||||||
|
|
Reference in New Issue