mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
Make User create comment Optional
This commit is contained in:
parent
4edc1a494f
commit
9dcd861a29
1 changed files with 5 additions and 2 deletions
|
@ -15,7 +15,7 @@ pub fn get_users(_: Params, state: &RpcState) -> Result<HashMap<String, User>, A
|
||||||
struct CreateUser {
|
struct CreateUser {
|
||||||
name: String,
|
name: String,
|
||||||
password: String,
|
password: String,
|
||||||
comment: String,
|
comment: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_user(p: Params, state: &RpcState) -> Result<(), ApiError> {
|
pub fn create_user(p: Params, state: &RpcState) -> Result<(), ApiError> {
|
||||||
|
@ -33,7 +33,10 @@ pub fn create_user(p: Params, state: &RpcState) -> Result<(), ApiError> {
|
||||||
.insert(
|
.insert(
|
||||||
u.name,
|
u.name,
|
||||||
User {
|
User {
|
||||||
comment: u.comment,
|
comment: match u.comment {
|
||||||
|
Some(c) => c,
|
||||||
|
None => "".to_string(),
|
||||||
|
},
|
||||||
hash: hash,
|
hash: hash,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue