Allow editing blogs with custom_domain
n.b.: no validation yet
This commit is contained in:
@@ -8,8 +8,9 @@ use openssl::{
|
||||
sign::{Signer, Verifier},
|
||||
};
|
||||
use rocket::{
|
||||
http::RawStr,
|
||||
outcome::IntoOutcome,
|
||||
request::{self, FromRequest, Request},
|
||||
request::{self, FromFormValue, FromRequest, Request},
|
||||
};
|
||||
use serde_json;
|
||||
use url::Url;
|
||||
@@ -71,6 +72,15 @@ impl<'a, 'r> FromRequest<'a, 'r> for Host {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> FromFormValue<'v> for Host {
|
||||
type Error = &'v RawStr;
|
||||
|
||||
fn from_form_value(form_value: &'v RawStr) -> std::result::Result<Host, &'v RawStr> {
|
||||
let val = String::from_form_value(form_value)?;
|
||||
Ok(Host::new(&val))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Queryable, Identifiable, Clone, AsChangeset)]
|
||||
#[changeset_options(treat_none_as_null = "true")]
|
||||
pub struct Blog {
|
||||
|
||||
Reference in New Issue
Block a user