[+] Implement family checking after login

This commit is contained in:
Hykilpikonna
2021-01-24 20:05:35 -05:00
parent 9c21cb61e3
commit e9387de879
2 changed files with 18 additions and 2 deletions
+14 -1
View File
@@ -48,7 +48,7 @@ class AccountViewController: UIViewController
func logout()
{
// Remove login info
["id", "user", "pass"].forEach { localStorage.removeObject(forKey: $0) }
["id", "user", "pass", "family"].forEach { localStorage.removeObject(forKey: $0) }
// Switch UI
vLogin.isHidden = false
@@ -100,6 +100,19 @@ class LoginVC: UIViewController
localStorage["pass"] = pass.sha256
localStorage["id"] = $0
send(APIs.familyGet)
{
localStorage["family"] = $0
self.loginSuccess(login)
}
err: { it in self.loginSuccess(login) }
}
}
private func loginSuccess(_ login: Bool)
{
ui
{
// Send feedback
if login { self.msg("Login success!", "Now you can use account features, yay!") }
else { self.msg("Registration success!", "Now you have an account, yay!") }