require name for new identity

This commit is contained in:
yggverse 2024-11-21 12:05:48 +02:00
parent 17f356dde7
commit eb21c4d844
2 changed files with 3 additions and 10 deletions

View File

@ -115,7 +115,7 @@ impl Gemini {
profile profile
.identity .identity
.gemini .gemini
.create(None, widget.form.name.value().as_deref()) .create(None, &widget.form.name.value().unwrap())
.unwrap(), // @TODO handle result, .unwrap(), // @TODO handle result,
), ),
}; };

View File

@ -56,11 +56,7 @@ impl Gemini {
/// Create new record /// Create new record
/// * return new `profile_identity_gemini_id` on success /// * return new `profile_identity_gemini_id` on success
pub fn create( pub fn create(&self, time: Option<(DateTime, DateTime)>, name: &str) -> Result<i64, Error> {
&self,
time: Option<(DateTime, DateTime)>,
name: Option<&str>,
) -> Result<i64, Error> {
// Generate new certificate // Generate new certificate
match certificate::generate( match certificate::generate(
match time { match time {
@ -70,10 +66,7 @@ impl Gemini {
DateTime::from_local(9999, 12, 31, 23, 59, 59.9).unwrap(), // max @TODO DateTime::from_local(9999, 12, 31, 23, 59, 59.9).unwrap(), // max @TODO
), ),
}, },
match name { name,
Some(value) => value, // @TODO make sure it's unique
None => "unknown", // @TODO randomize
},
) { ) {
Ok(pem) => match self.database.add(&pem) { Ok(pem) => match self.database.add(&pem) {
Ok(profile_identity_gemini_id) => { Ok(profile_identity_gemini_id) => {