WT1.1.2 build 32 login error messages fixes

This commit is contained in:
bossanyit
2020-11-20 15:32:06 +01:00
parent 3ce32434bf
commit ed8760f8e8
13 changed files with 90 additions and 97 deletions
+14 -7
View File
@@ -7,7 +7,7 @@ class UserRepository {
User user;
UserRepository() {
this.createNewUser();
this.createNewUser();
}
setEmail(String email) {
@@ -24,10 +24,15 @@ class UserRepository {
Future<void> addUser() async {
final User modelUser = this.user;
String rc = await FirebaseApi().registerEmail(modelUser.email, modelUser.password);
if ( rc == FirebaseApi.SIGN_IN_OK ) {
modelUser.firebaseUid = Cache().firebaseUid;
await CustomerApi().addUser(modelUser);
try {
String rc = await FirebaseApi().registerEmail(modelUser.email, modelUser.password);
if (rc == FirebaseApi.SIGN_IN_OK) {
modelUser.firebaseUid = Cache().firebaseUid;
await CustomerApi().addUser(modelUser);
}
} catch (e) {
print(e.toString());
throw new Exception(e);
}
}
@@ -35,12 +40,14 @@ class UserRepository {
final User modelUser = this.user;
String rc = await FirebaseApi().signInEmail(modelUser.email, modelUser.password);
if ( rc == FirebaseApi.SIGN_IN_OK ) {
if (rc == FirebaseApi.SIGN_IN_OK) {
print("Firebase login ok");
await CustomerApi().getUserByEmail(modelUser.email);
print("GetUserBy Email OK");
Cache().afterFirebaseLogin();
} else {
throw Exception("Exception: Customer does not exist or the password is wrong");
print("Exception: user not found or password is wrong");
throw Exception("Customer does not exist or the password is wrong");
}
}