diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java index 6c87f0d..05d0240 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java @@ -246,8 +246,27 @@ public class ServerCommunication JSONObject json = (JSONObject) new JSONTokener(r).nextValue(); - if (!json.getBoolean("success")) { + if (!json.getBoolean("success")) + { SCNApp.showToast(json.getString("message"), 4000); + + int errid = json.optInt("errid", 0); + + if (errid == 201 || errid == 202 || errid == 203 || errid == 204) + { + // user not found or auth failed + + SCNSettings.inst().user_id = -1; + SCNSettings.inst().user_key = ""; + SCNSettings.inst().quota_curr = 0; + SCNSettings.inst().quota_max = 0; + SCNSettings.inst().promode_server = false; + SCNSettings.inst().fcm_token_server = ""; + SCNSettings.inst().save(); + + SCNApp.refreshAccountTab(); + } + return; } diff --git a/web/schema.sql b/web/schema.sql index ec0fd5e..acf2653 100644 --- a/web/schema.sql +++ b/web/schema.sql @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `user_id` INT(11) NOT NULL AUTO_INCREMENT, @@ -16,6 +17,7 @@ CREATE TABLE `users` PRIMARY KEY (`user_id`) ); +DROP TABLE IF EXISTS `messages`; CREATE TABLE `messages` ( `scn_message_id` INT(11) NOT NULL AUTO_INCREMENT, @@ -31,4 +33,4 @@ CREATE TABLE `messages` `usr_message_id` VARCHAR(256) NULL, PRIMARY KEY (`scn_message_id`) -) \ No newline at end of file +); \ No newline at end of file