Allow editing blogs with custom_domain

n.b.: no validation yet
This commit is contained in:
Igor Galić
2019-08-20 12:24:36 +02:00
parent df47cddb87
commit 064dd79eef
2 changed files with 13 additions and 1 deletions
+11 -1
View File
@@ -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 {