mirror of
https://github.com/simple-login/app.git
synced 2025-09-23 06:54:38 +08:00
fix: add type check on create custom alias api (#2385)
This commit is contained in:
parent
da93431df8
commit
1d2777c5a4
1 changed files with 11 additions and 2 deletions
|
@ -62,8 +62,17 @@ def new_custom_alias_v2():
|
||||||
if not data:
|
if not data:
|
||||||
return jsonify(error="request body cannot be empty"), 400
|
return jsonify(error="request body cannot be empty"), 400
|
||||||
|
|
||||||
alias_prefix = data.get("alias_prefix", "").strip().lower().replace(" ", "")
|
alias_prefix = data.get("alias_prefix", "")
|
||||||
signed_suffix = data.get("signed_suffix", "").strip()
|
if not isinstance(alias_prefix, str) or not alias_prefix:
|
||||||
|
return jsonify(error="invalid value for alias_prefix"), 400
|
||||||
|
|
||||||
|
alias_prefix = alias_prefix.strip().lower().replace(" ", "")
|
||||||
|
signed_suffix = data.get("signed_suffix", "")
|
||||||
|
if not isinstance(signed_suffix, str) or not signed_suffix:
|
||||||
|
return jsonify(error="invalid value for signed_suffix"), 400
|
||||||
|
|
||||||
|
signed_suffix = signed_suffix.strip()
|
||||||
|
|
||||||
note = data.get("note")
|
note = data.get("note")
|
||||||
alias_prefix = convert_to_id(alias_prefix)
|
alias_prefix = convert_to_id(alias_prefix)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue