From d57b2d486522635485dd3a26df2a6dcfeb0ef634 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 28 Dec 2019 20:58:01 -0500 Subject: Fixing non-existent user profile viewing. - Fixes #381 --- server/src/api/user.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'server/src/api/user.rs') diff --git a/server/src/api/user.rs b/server/src/api/user.rs index 9a343427..a04ba4b2 100644 --- a/server/src/api/user.rs +++ b/server/src/api/user.rs @@ -367,11 +367,13 @@ impl Perform for Oper { let user_details_id = match data.user_id { Some(id) => id, None => { - User_::read_from_name( + match User_::read_from_name( &conn, data.username.to_owned().unwrap_or("admin".to_string()), - )? - .id + ) { + Ok(user) => user.id, + Err(_e) => return Err(APIError::err(&self.op, "couldnt_find_that_username_or_email"))? + } } }; -- cgit v1.2.3