fix: 因應資料庫欄位修改2
1. 使用Username作為primary key 2. Username, Email 皆可作為登入依據
This commit is contained in:
@@ -183,7 +183,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
String password = _passwordController.text;
|
||||
|
||||
var result = await conn.execute(
|
||||
'SELECT * FROM HomeLogin WHERE homeEmail = :email OR homeName = :name',
|
||||
'SELECT * FROM HomeLogin WHERE homeEmail = :email OR homeUserName = :name',
|
||||
{'email': email, 'name': name},
|
||||
);
|
||||
|
||||
@@ -192,9 +192,8 @@ 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)',
|
||||
'INSERT INTO HomeLogin (homeUserName, homeEmail, homePassword) VALUES (:name, :email, :password)',
|
||||
{'name': name, 'email': email, 'password': password},
|
||||
);
|
||||
|
||||
@@ -269,8 +268,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.person_outlined),
|
||||
// TODO: user name in database setting as primary is not suitable change to username would better
|
||||
labelText: '用戶姓名',
|
||||
labelText: '使用者名稱',
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
||||
Reference in New Issue
Block a user