Ejemplo n.º 1
0
    public async Task <long> GetLastUserCardCollectioModificationTimestampUser(string name)
    {
        if (DatosFirebaseRTHelper.Instance.isInit == false)
        {
            //Debug.Log("FIREBASE NOT INITIALIZE");
            return(0);
        }

        //FirebaseDatabase.DefaultInstance.GetReference("Users").Child(name).KeepSynced(true);

        FbUserChecker fbUser        = new FbUserChecker();
        DataSnapshot  userNameExist = await fbUser.UserDataSnapshotExistByName(name.ToLower());

        long utcLastUCCDownload = 0;

        if (userNameExist != null)
        {
            if (userNameExist.Exists)
            {
                UserDB user = JsonUtility.FromJson <UserDB>(userNameExist.GetRawJsonValue());
                utcLastUCCDownload = user.utcLastModificationUserCollectionUnix;
                //Debug.Log("user.MAcc " + user.Salt);
            }
        }

        return(utcLastUCCDownload);
    }
Ejemplo n.º 2
0
    private async Task <UserDB> LoginUserWithFirebaseRTCustomLogin(string ussername, string password, Action <string> OnErrorCallback)
    {
        // CHEQUEAR SI HAY UN USUARIO CON EL MISMO NOMBRE
        FbUserChecker userChk       = new FbUserChecker();
        DataSnapshot  userNameExist = await userChk.UserDataSnapshotExistByName(ussername);

        UserDB logedUser = null;

        if (userNameExist != null && userNameExist.Exists)
        {
            UserDB user = JsonUtility.FromJson <UserDB>(userNameExist.GetRawJsonValue());

            if (HelperUserData.isCorrectPassword(user.Salt, user.Password, password, new SHA256Managed()))
            {
                Debug.Log("user.Name.ToLower() " + user.Name.ToLower());
                logedUser = user;
            }
            else
            {
                OnErrorCallback?.Invoke("PASSWORD INCORRECT SALT " + user.Salt + " PASS " + user.Password + " password " + password);
            }
        }
        else
        {
            OnErrorCallback?.Invoke("NAME INCORRECT");
        }
        return(logedUser);
    }
    public async Task <long> GetLastUserCardLimitDataDownloadTimestampUser(string name)
    {
        if (DatosFirebaseRTHelper.Instance.isInit == false)
        {
            return(0);
        }

        FbUserChecker userCheck     = new FbUserChecker();
        DataSnapshot  userNameExist = await userCheck.UserDataSnapshotExistByName(name.ToLower());

        long utcLastUCCDownload = 0;

        if (userNameExist != null)
        {
            if (userNameExist.Exists)
            {
                UserDB user = JsonUtility.FromJson <UserDB>(userNameExist.GetRawJsonValue());
                utcLastUCCDownload = user.utcLastDownloadCardLimitDataUnix;
            }
        }

        return(utcLastUCCDownload);
    }