Trim the preferred username.
This commit is contained in:
parent
716bdcdd25
commit
9127f7cf0c
1 changed files with 2 additions and 2 deletions
|
@ -578,10 +578,10 @@ impl Perform for Oper<SaveUserSettings> {
|
||||||
// The DB constraint should stop too many characters
|
// The DB constraint should stop too many characters
|
||||||
let preferred_username = match &data.preferred_username {
|
let preferred_username = match &data.preferred_username {
|
||||||
Some(preferred_username) => {
|
Some(preferred_username) => {
|
||||||
if !is_valid_preferred_username(preferred_username) {
|
if !is_valid_preferred_username(preferred_username.trim()) {
|
||||||
return Err(APIError::err("invalid_username").into());
|
return Err(APIError::err("invalid_username").into());
|
||||||
}
|
}
|
||||||
Some(preferred_username.to_owned())
|
Some(preferred_username.trim().to_string())
|
||||||
}
|
}
|
||||||
None => read_user.preferred_username,
|
None => read_user.preferred_username,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue