Basic domain validation
The actual DNS check still needs to be written
This commit is contained in:
		
							parent
							
								
									60270121dc
								
							
						
					
					
						commit
						da6757c55c
					
				| @ -155,10 +155,11 @@ pub fn create(form: LenientForm<NewBlogForm>, rockets: PlumeRocket) -> RespondOr | |||||||
|     let intl = &rockets.intl.catalog; |     let intl = &rockets.intl.catalog; | ||||||
|     let user = rockets.user.clone().unwrap(); |     let user = rockets.user.clone().unwrap(); | ||||||
| 
 | 
 | ||||||
|     let custom_domain = if form.custom_domain.is_empty() { |     let (custom_domain, dns_ok) = if form.custom_domain.is_empty() { | ||||||
|         None |         (None, true) | ||||||
|     } else { |     } else { | ||||||
|         Some(Host::new(form.custom_domain.clone())) |         let dns_check = true; // TODO
 | ||||||
|  |         (Some(Host::new(form.custom_domain.clone())), dns_check) | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     let mut errors = match form.validate() { |     let mut errors = match form.validate() { | ||||||
| @ -208,11 +209,19 @@ pub fn create(form: LenientForm<NewBlogForm>, rockets: PlumeRocket) -> RespondOr | |||||||
|     ) |     ) | ||||||
|     .expect("blog::create: author error"); |     .expect("blog::create: author error"); | ||||||
| 
 | 
 | ||||||
|     Flash::success( |     if dns_ok { | ||||||
|         Redirect::to(uri!(details: name = slug.clone(), page = _)), |         Flash::success( | ||||||
|         &i18n!(intl, "Your blog was successfully created!"), |             Redirect::to(uri!(details: name = slug.clone(), page = _)), | ||||||
|     ) |             &i18n!(intl, "Your blog was successfully created!"), | ||||||
|     .into() |         ) | ||||||
|  |         .into() | ||||||
|  |     } else { | ||||||
|  |         Flash::warn( | ||||||
|  |             Redirect::to(uri!(details: name = slug.clone(), page = _)), | ||||||
|  |             &i18n!(intl, "Your blog was successfully created, but the custom domain seems invalid. Please check it is correct from your blog's settings."), | ||||||
|  |         ) | ||||||
|  |         .into() | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[post("/~/<name>/delete")] | #[post("/~/<name>/delete")] | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user