From eb21c4d84441236b41fdc2d4f0bad54d972c03c3 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 21 Nov 2024 12:05:48 +0200 Subject: [PATCH] require name for new identity --- src/app/browser/window/tab/item/identity/gemini.rs | 2 +- src/profile/identity/gemini.rs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/app/browser/window/tab/item/identity/gemini.rs b/src/app/browser/window/tab/item/identity/gemini.rs index 5f9ad71e..63214f53 100644 --- a/src/app/browser/window/tab/item/identity/gemini.rs +++ b/src/app/browser/window/tab/item/identity/gemini.rs @@ -115,7 +115,7 @@ impl Gemini { profile .identity .gemini - .create(None, widget.form.name.value().as_deref()) + .create(None, &widget.form.name.value().unwrap()) .unwrap(), // @TODO handle result, ), }; diff --git a/src/profile/identity/gemini.rs b/src/profile/identity/gemini.rs index 87a5653b..495eaeea 100644 --- a/src/profile/identity/gemini.rs +++ b/src/profile/identity/gemini.rs @@ -56,11 +56,7 @@ impl Gemini { /// Create new record /// * return new `profile_identity_gemini_id` on success - pub fn create( - &self, - time: Option<(DateTime, DateTime)>, - name: Option<&str>, - ) -> Result { + pub fn create(&self, time: Option<(DateTime, DateTime)>, name: &str) -> Result { // Generate new certificate match certificate::generate( match time { @@ -70,10 +66,7 @@ impl Gemini { DateTime::from_local(9999, 12, 31, 23, 59, 59.9).unwrap(), // max @TODO ), }, - match name { - Some(value) => value, // @TODO make sure it's unique - None => "unknown", // @TODO randomize - }, + name, ) { Ok(pem) => match self.database.add(&pem) { Ok(profile_identity_gemini_id) => {