【发布时间】:2017-04-11 18:21:00
【问题描述】:
我想让用户名只包含字符和数字。
"user_lookup": {
".read": "auth !== null",
"$username": {
".write": "!data.exists()",
".validate": "
newData.val().matches(/^[a-z][a-z0-9]*([._-][a-z0-9]+)*$/) &&
newData.isString()",
"$uid": {
".validate": "newData.val() == auth.uid"
},
验证失败。如果我添加验证,无论里面是什么,它都会失败。
任何提示将不胜感激。
模拟器截图:
【问题讨论】:
-
-
您能否显示代码(或模拟器的屏幕截图):正在写入的值、正在写入的位置以及身份验证数据?
-
@FrankvanPuffelen 好的,你是i.gyazo.com/efc25cf15694e87da090ce226adbae44.png,如果我删除验证它成功i.gyazo.com/d33fa4158ae00d9cf4a7d2a5791810e9.png 但我只想为用户名写字符和数字。
标签: firebase firebase-realtime-database firebase-security