mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 15:22:56 +00:00
chore: open userinfo constructor (#774)
This commit is contained in:
@@ -69,7 +69,6 @@ impl UserInfo {
|
||||
&self.username
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn new(username: impl Into<String>) -> Self {
|
||||
Self {
|
||||
username: username.into(),
|
||||
@@ -165,9 +164,7 @@ pub mod test {
|
||||
Password::PlainText(password) => {
|
||||
if username == "greptime" {
|
||||
if password == "greptime" {
|
||||
return Ok(UserInfo {
|
||||
username: "greptime".to_string(),
|
||||
});
|
||||
return Ok(UserInfo::new("greptime"));
|
||||
} else {
|
||||
return super::UserPasswordMismatchSnafu {
|
||||
username: username.to_string(),
|
||||
|
||||
@@ -113,9 +113,7 @@ impl UserProvider for StaticUserProvider {
|
||||
match input_pwd {
|
||||
Password::PlainText(pwd) => {
|
||||
return if save_pwd == pwd.as_bytes() {
|
||||
Ok(UserInfo {
|
||||
username: username.to_string(),
|
||||
})
|
||||
Ok(UserInfo::new(username))
|
||||
} else {
|
||||
UserPasswordMismatchSnafu {
|
||||
username: username.to_string(),
|
||||
@@ -152,7 +150,7 @@ fn auth_mysql(
|
||||
}
|
||||
let candidate_stage_2 = sha1_one(&xor_result);
|
||||
if candidate_stage_2 == hash_stage_2 {
|
||||
Ok(UserInfo { username })
|
||||
Ok(UserInfo::new(username))
|
||||
} else {
|
||||
UserPasswordMismatchSnafu { username }.fail()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user