mirror of
https://github.com/kanidm/kanidm.git
synced 2025-05-05 08:35:04 +02:00
fix(web): Preserve SSH key content on form validation error
This commit is contained in:
parent
8424863969
commit
4f261c906e
server/core
|
@ -121,6 +121,7 @@ struct SetUnixCredPartial {
|
|||
struct AddSshPublicKeyPartial {
|
||||
title_error: Option<String>,
|
||||
key_error: Option<String>,
|
||||
key_value: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -902,6 +903,7 @@ pub(crate) async fn view_add_ssh_publickey(
|
|||
return Ok((AddSshPublicKeyPartial {
|
||||
title_error: None,
|
||||
key_error: None,
|
||||
key_value: None,
|
||||
},)
|
||||
.into_response());
|
||||
}
|
||||
|
@ -920,6 +922,7 @@ pub(crate) async fn view_add_ssh_publickey(
|
|||
return Ok((AddSshPublicKeyPartial {
|
||||
title_error: None,
|
||||
key_error: Some("Key cannot be parsed".to_string()),
|
||||
key_value: Some(new_key.key),
|
||||
},)
|
||||
.into_response());
|
||||
}
|
||||
|
@ -965,6 +968,7 @@ pub(crate) async fn view_add_ssh_publickey(
|
|||
AddSshPublicKeyPartial {
|
||||
title_error,
|
||||
key_error,
|
||||
key_value: Some(new_key.key),
|
||||
},
|
||||
)
|
||||
.into_response())
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<textarea class="form-control(% if let Some(_) = key_error %) is-invalid(% endif %)" id="key-content" rows="5" name="key"
|
||||
aria-describedby="key-validation-feedback"
|
||||
placeholder="Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'"
|
||||
></textarea>
|
||||
>(% if let Some(key_value) = key_value %)(( key_value ))(% endif %)</textarea>
|
||||
<div id="key-validation-feedback" class="invalid-feedback">
|
||||
(% if let Some(key_error) = key_error %)(( key_error ))(% endif %)
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue