Strip leading @ from password reset input
This commit is contained in:
13
app/soapbox/utils/input.ts
Normal file
13
app/soapbox/utils/input.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/** Trim the username and strip the leading @. */
|
||||
const normalizeUsername = (username: string): string => {
|
||||
const trimmed = username.trim();
|
||||
if (trimmed[0] === '@') {
|
||||
return trimmed.slice(1);
|
||||
} else {
|
||||
return trimmed;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
normalizeUsername,
|
||||
};
|
||||
Reference in New Issue
Block a user