fix: 修正重複註冊防呆邏輯

This commit is contained in:
JingChiang
2024-09-08 20:45:54 +08:00
parent c3533e6338
commit 7d06f83d38

View File

@@ -176,8 +176,8 @@ class _RegisterPageState extends State<RegisterPage> {
String password = _passwordController.text;
var result = await conn.execute(
'SELECT * FROM HomeLogin WHERE homeEmail = :email AND homePassword = :password',
{'email': email, 'password': password},
'SELECT * FROM HomeLogin WHERE homeEmail = :email',
{'email': email},
);
if (result.rows.isNotEmpty) {
@@ -185,6 +185,7 @@ class _RegisterPageState extends State<RegisterPage> {
SnackBar(content: Text('註冊失敗:電子信箱已被使用,請嘗試更換電子信箱')),
);
} else {
// TODO: Phone Address is setting not null in database, remove it or setting default value
await conn.execute(
'INSERT INTO HomeLogin (homeName, homeEmail, homePassword) VALUES (:name, :email, :password)',
{'name': name, 'email': email, 'password': password},