コード例 #1
0
 public void FirebaseSignUp(string email, string password)
 {
     if (CheckSignUpError())
     {
         RigisterFail();
         return;
     }
     auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
     {
         if (task.IsCanceled)
         {
             Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
             return;
         }
         if (task.IsFaulted)
         {
             Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
             return;
         }
         FirebaseUser newUser = task.Result; // 신규 유저 생성
         Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
         DatabaseManager.Instance.NewRegistration();
     });
     RigisterSuccess();
 }
コード例 #2
0
    public async void ButtonRegister()
    {
        string name      = this.name.text;
        string login     = this.login.text;
        string passoword = this.password.text;
        string confirm   = this.confirmPassword.text;

        if (passoword == confirm)
        {
            await auth.CreateUserWithEmailAndPasswordAsync(login, passoword).ContinueWith(task =>
            {
                if (auth.CurrentUser == null)
                {
                    Debug.Log("Ocorreu um erro no cadastro");
                }
                else
                {
                    EnviarEmailVerificacao();

                    Logout();
                }
            });
        }
        else
        {
            Debug.Log("Confirmação de senha inválida");
        }
    }
コード例 #3
0
ファイル: LoginManager.cs プロジェクト: sewonist/PotatoSurya
    public void FirebaseCreate(string email, string password)
    {
        infoText1.text = "firebase created".ToString();
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                infoText1.text = "CreateUserWithEmailAndPasswordAsync was canceled.".ToString();
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                infoText1.text = "CreateUserWithEmailAndPasswordAsync encountered an error:".ToString();
                FirebaseSignIn(email, password);
                infoText1.text = "Logged into Firebase".ToString();

                return;
            }
            infoText1.text = "inside firebase".ToString();
            // Firebase user has been created.
            UIManager.instance.OpenPage(1);

            user = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            user.DisplayName, user.UserId);
            infoText1.text = "Firebase user created successfully: {0} ({1})".ToString();
        });
    }
コード例 #4
0
    public void SignUp(string email, string password)
    {
        if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
        {
            //Error handling
            return;
        }

        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }

            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                return;
            }

            Firebase.Auth.FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
            ErrorText.text = String.Format("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
        });
    }
コード例 #5
0
    /*
     * Use Email Id and Password to Register a User in Firebase
     */

    public void RegisterWithEmail(string email, string password, System.Action <string> callback)
    {
        m_auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWithOnMainThread(task =>
        {
            if (task.IsCanceled)
            {
                if (Debug.isDebugBuild)
                {
                    Debug.LogError("SignInWithEmailAndPassword was canceled.");
                }
                return;
            }
            else if (task.IsFaulted)
            {
                FirebaseException exception = task.Exception.InnerExceptions[0].InnerException as FirebaseException;
                var errCode = (AuthError)exception.ErrorCode;
                Debug.Log(errCode.ToString());
                callback(errCode.ToString());
                //Debug.LogError("SignInWithEmailAndPassword encountered an error: " + task.Exception);
                return;
            }
            else if (task.IsCompleted)
            {
                m_user = task.Result;
                Debug.LogFormat("User signed in successfully: {0} ({1})", m_user.DisplayName, m_user.UserId);

                Base_UIPanel nextPanel = UIManager.instance.profileSetupPanel;
                UIManager.instance.TriggerPanelTransition(nextPanel);
            }
        });
    }
コード例 #6
0
    public void SignUp() // sign up 회원가입
    {
        if (!IsFirebaseReady)
        {
            return;
        }

        signButton.interactable = false;

        firebaseAuth.CreateUserWithEmailAndPasswordAsync(emailField.text, passwordField.text).ContinueWithOnMainThread(task =>
        {
            signButton.interactable = true;

            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            else if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
            }
            else
            {
                signButton.interactable = true;
                // Firebase user has been created.
                FirebaseUser newUser = task.Result;
                Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
            }
        });
    }
コード例 #7
0
    void CreateUser()
    {
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                email_panel.SetActive(true);
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                email_panel.SetActive(true);
                return;
            }

            // Firebase user has been created.
            Firebase.Auth.FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            Reset.reset();
            this.gameObject.GetComponent <DB_control>().Write_outside(newUser.UserId);

            success_panel.SetActive(true);
        });
    }
コード例 #8
0
    public void Create_User()
    {
        validation.text = "";
        validateInput();


        if (validation.text == "")
        {
            auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
            Debug.Log("Email : " + email.text + " Password : "******"SignInWithEmailAndPasswordAsync was canceled.");
                    return;
                }
                if (task.IsFaulted)
                {
                    Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                    return;
                }
                Firebase.Auth.FirebaseUser newUser = task.Result;
                Debug.LogFormat("User signed in successfully: {0} ({1})",
                                newUser.DisplayName, newUser.UserId);
            });
        }
    }
コード例 #9
0
ファイル: AuthManager.cs プロジェクト: aadimator/khoji-ar
 public void SignUpNewUser(string email, string password)
 {
     auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
     {
         StartCoroutine(authCallback(task, "sign_up"));
     });
 }
コード例 #10
0
    public void CreateUser()
    {
        auth.CreateUserWithEmailAndPasswordAsync(idIF.text, passwordIF.text).ContinueWithOnMainThread(task =>
        {
            if (!task.IsCanceled && !task.IsFaulted)
            {
                imageURL                  = HashEmailForGravatar(idIF.text);
                User user                 = new User(idIF.text, nicknameIF.text, $"http://gravatar.com/avatar/{imageURL}?d=identicon");
                string userJson           = JsonUtility.ToJson(user);
                FirebaseUser firebaseUser = FirebaseAuth.DefaultInstance.CurrentUser;
                UID = firebaseUser.UserId;

                reference.Child(UID).SetRawJsonValueAsync(userJson);

                connInfoText.text = "회원가입 성공";
                Debug.Log(idIF.text + " 로 회원가입 하셨습니다.");
                Debug.Log(UID);
                LoginManager.nickname = nicknameIF.text;


                FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://project-6629124072636312930-default-rtdb.firebaseio.com/");
                reference         = FirebaseDatabase.DefaultInstance.GetReference("auto/" + LoginManager.nickname); // prefabs 위치 참조
                UserInfo tempUser = new UserInfo(idIF.text, passwordIF.text, ipIF.text);
                string json       = JsonUtility.ToJson(tempUser);
                reference.SetRawJsonValueAsync(json);
                CreateChatRoom();
            }
            else
            {
                connInfoText.text = "회원가입 실패";
                Debug.Log("회원가입에 실패하셨습니다.");
            }
        });
    }
コード例 #11
0
 public void SignUp(string userName, string email, string password)
 {
     Toast.m_Instance.ShowMessageUntilinterrupt("user sign up... Is connected to internet : " + GameManager.m_Instance.IsConnectedToInternet);
     m_auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith((task) =>
     {
         if (task.IsCanceled)
         {
             Toast.m_Instance.ShowMessage("Create User with email and password async was canceled...", 5);
         }
         else if (task.IsFaulted)
         {
             Toast.m_Instance.ShowMessage("Create User with email and password async encountered an error: " + task.Exception, 5);
         }
         else if (task.IsCompleted)
         {
             FirebaseRealtimeDatabase.m_Instance.AddNewUserToDatabase(userName, email, m_auth.CurrentUser.UserId);
             UserProfile userProfile = new UserProfile();
             userProfile.DisplayName = userName;
             m_auth.CurrentUser.UpdateUserProfileAsync(userProfile).ContinueWith(profileTask =>
             {
                 if (profileTask.IsCanceled || profileTask.IsFaulted)
                 {
                     Toast.m_Instance.ShowMessage("Profile update is canceled or faulted");
                 }
                 else if (profileTask.IsCompleted)
                 {
                     Toast.m_Instance.ShowMessage("Profile update is completed");
                     GameManager.m_Instance.m_OwnerInfo = new PlayerInfo(task.Result.DisplayName, task.Result.UserId);
                     MenuController.m_Instance.ShowMenuPage(MenuPage.CreateJoinGameMenu);
                 }
             });
         }
     });
 }
コード例 #12
0
ファイル: FirebaseManager.cs プロジェクト: ty-ler/ar-project
    // This method is not currently in use
    public async Task <bool> SignUp(string email, string password)
    {
        bool result = false;

        // Await the async CreateUser call
        await auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return(false);
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                return(false);
            }

            // Firebase user has been created.
            FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);

            result = true;
            return(true);
        });

        return(result);
    }
コード例 #13
0
    public void Join()
    {
        if (!InputCheck())
        {
            return;
        }
        string email    = emailInputField.text;
        string password = passwordInputField.text;

        // 인증객체를 이용하여 이메일과 비밀번호로 가입을 수행합니다.
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith
        (
            task =>
        {
            if (!task.IsCanceled && !task.IsFaulted)
            {
                messageUI.text = "Success Sign up";
                SceneManager.LoadScene("LoginScene");
            }
            else
            {
                messageUI.text = "이미 사용중이거나 형식이 올바르지 않습니다.";
            }
        }
        );
    }
コード例 #14
0
    public void GoogleJoin(string email, string password, string nickname)
    {
        _controller.OnProgressBar("회원가입 진행중..");

        Debug.Log("google join start");
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                //UIManager.Instance.OnWarningMsg(task.Exception.Message);
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                _controller.OffProgressBar();
                _controller.OnWarningMsg(task.Exception.Message);
                _controller.OffJoinPage();
                return;
            }

            // Firebase user has been created.
            newUser        = task.Result;
            User user      = new User();
            user.nickname  = nickname;
            user.email     = email;
            user.isAlarmOn = true;

            SaveUserData(newUser.UserId, user);

            _controller.OffProgressBar();
            _controller.OnWarningMsg("회원가입을 완료하였습니다.");
            _controller.OffJoinPage();
        });
    }
コード例 #15
0
    private void CreateUser()
    {
        auth.CreateUserWithEmailAndPasswordAsync(SignUpEmail, SignUpPassword).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                SignUpLoadingEnd();
                wrongTotal();
                return;
            }

            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                SignUpLoadingEnd();
                wrongTotal();
                return;
            }

            // Firebase User has been created.
            Firebase.Auth.FirebaseUser newUser = task.Result;
            SignUpLoadingEnd();
            //Debug.LogFormat("Firebase user created successfully - DisplayName:({0}), UserId:({1})", newUser.DisplayName, newUser.UserId);
            MainManager.Instance.toSignInPanel();
        });
    }
コード例 #16
0
ファイル: AuthUser.cs プロジェクト: nnton3/AR_Tutor
    public Task <SignUpResult> CreateUser(string email, string password)
    {
        return(auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                return SignUpResult.Canceled;
            }

            if (task.IsFaulted)
            {
                if (task.Exception.ToString().Contains("The email address is already in use"))
                {
                    return SignUpResult.EmailAlreadyUse;
                }
                return SignUpResult.Faulted;
            }

            // Firebase user has been created.
            newUser = task.Result;
            UserID = newUser?.UserId;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);

            return SignUpResult.Success;
        }));
    }
コード例 #17
0
    public async void CadastrarUsuario()
    {
        if (senha.text == confirmarSenha.text)
        {
            PreCadastro();

            await auth.CreateUserWithEmailAndPasswordAsync(email.text, senha.text).ContinueWith(task =>
            {
            });

            if (auth.CurrentUser != null)
            {
                EnviarEmailVerificacao();

                RegistrarNick();

                PosCadastro();

                LimpaDados();
            }
            else
            {
                Debug.Log("Verifique seu email ou sua senha!");

                PosCadastro();
            }
        }
        else
        {
            Debug.Log("Senhas não são iguais!");
        }
    }
コード例 #18
0
    public void Join()
    {
        if (!InputCheck())
        {
            return;
        }
        string email    = emailInputField.text;
        string password = passwordInputField.text;
        var    content  = TaskScheduler.FromCurrentSynchronizationContext();

        messageUI.text = "잠시만 기다려주세요.";
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(
            task =>
        {
            if (!task.IsCanceled && !task.IsFaulted)
            {
                messageUI.text = "회원가입이 완료되었습니다.";
            }
            else
            {
                messageUI.text = "이미 사용 중이거나 이메일 형식이 올바르지 않습니다.";
            }
        }
            , content
            );
    }
コード例 #19
0
        /// <summary>
        /// Creates the user with email and password async.
        /// </summary>
        /// <param name="email">Email.</param>
        /// <param name="password">Password.</param>
        /// <param name="onDone">On done.</param>
        public void CreateUserWithEmailAndPasswordAsync(string email, string password, System.Action <LoginResult> onDone)
        {
            Debug.Log(string.Format("Attempting to create user {0}...", email));
            auth.CreateUserWithEmailAndPasswordAsync(email, password)
            .ContinueWith((authTask) =>
            {
                if (authTask.IsCanceled)
                {
                    Debug.Log("CreateUserWithEmailAndPasswordAsync canceled.");
                    if (onDone != null)
                    {
                        onDone(LoginResult.CANCELLED);
                    }
                }
                else if (authTask.IsFaulted)
                {
                    Debug.Log("CreateUserWithEmailAndPasswordAsync encounted an error.");
                    Debug.LogError(authTask.Exception.ToString());
                    if (onDone != null)
                    {
                        onDone(LoginResult.ERROR);
                    }
                }
                else if (authTask.IsCompleted)
                {
                    Debug.Log("CreateUserWithEmailAndPasswordAsync completed");
//                        UpdateUserProfile(newDisplayName: newDisplayName);
//                        Firebase.Auth.FirebaseUser newUser = authTask.Result;
                    if (onDone != null)
                    {
                        onDone(LoginResult.OK);
                    }
                }
            });
        }
コード例 #20
0
    public void Signup(string email, string password)
    {
        if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
        {
            //Error handling
            return;
        }

        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync error: " + task.Exception);
                if (task.Exception.InnerExceptions.Count > 0)
                {
                    UpdateErrorMessage(task.Exception.InnerExceptions[0].Message);
                }
                return;
            }

            FirebaseUser newUser = task.Result; // Firebase user has been created.
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            UpdateErrorMessage("Signup Success");
        });
    }
コード例 #21
0
    //LOGIN/REGISTER PART

    public void Registration()
    {
        auth.CreateUserWithEmailAndPasswordAsync(RegistrationEmail.text, RegistrationPassword.text).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                return;
            }

            // Firebase user has been created.
            Firebase.Auth.FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            UserName = newUser.UserId;
            Debug.Log("za da se predade " + newUser.UserId);
            Debug.Log("USER NAME " + UserName);

            UIManager.Instance.FromRegisterToLogin();
        });
    }
コード例 #22
0
        private async void CreateUser(object sender, EventArgs e)
        {
            var creating = FindViewById <RelativeLayout>(Resource.Id.creating_account);

            creating.Visibility = ViewStates.Visible;
            if (this.IsValidLogin())
            {
                var email    = this.emailEdit.Text;
                var password = this.passwordEdit.Text;
                try
                {
                    await FirebaseAuth.CreateUserWithEmailAndPasswordAsync(email, password);

                    this.confirmError.Visibility  = ViewStates.Invisible;
                    this.emailError.Visibility    = ViewStates.Invisible;
                    this.passwordError.Visibility = ViewStates.Invisible;
                    creating.Visibility           = ViewStates.Invisible;
                    StartActivity(typeof(MainActivity));
                }
                catch (FirebaseAuthException ex)
                {
                    Console.WriteLine(ex);
                    creating.Visibility = ViewStates.Invisible;
                }
            }
        }
コード例 #23
0
 void FirebaseSignUp()
 {
     auth.CreateUserWithEmailAndPasswordAsync(SPEmailEdit.text, SPPwdEdit.text).ContinueWith(task => {
         if (task.IsCanceled)
         {
             loadingPanel.SetActive(false);
             Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
             return;
         }
         if (task.IsFaulted)
         {
             loadingPanel.SetActive(false);
             Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
             return;
         }
         this.user = task.Result;
         Debug.LogFormat("Firebase user created successfully: {0} ({1})", this.user.DisplayName, this.user.UserId);
         DocumentReference docRef            = db.Collection("Users").Document(user.UserId);
         Dictionary <string, object> userDoc = new Dictionary <string, object>
         {
             { "email", SPEmailEdit.text },
             { "uid", this.user.UserId },
             { "name", SPPwdEdit.text },
         };
         docRef.SetAsync(userDoc).ContinueWithOnMainThread(task1 => {
             loadingPanel.SetActive(false);
             Debug.Log("Added data to the alovelace document in the users collection.");
             SceneManager.LoadScene("Home");
         });
     });
 }
コード例 #24
0
        void CreateUserWithEmailAndPasswordAsync()
        {
            auth.CreateUserWithEmailAndPasswordAsync(credentialUser.email, credentialUser.password)
            .ContinueWithOnMainThread(task =>
            {
                if (task.IsCanceled)
                {
                    Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                    loginCallback?.Invoke(EnumLoginState.Error, null);
                    return;
                }

                if (task.IsFaulted)
                {
                    Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                    loginCallback?.Invoke(EnumLoginState.Error, null);
                    return;
                }

                // Firebase user has been created.
                FirebaseUser newUser = task.Result;
                loginCallback?.Invoke(EnumLoginState.Success, CopyToSocialUser(newUser));
                Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
            });
        }
コード例 #25
0
        public async Task <string> RegsiterWithEmailPassword(string email, string password)
        {
            //  var user = await Firebase.Auth.FirebaseAuth.Instance.CreateUserWithEmailAndPasswordAsync(email, password);
            var user = await auth.CreateUserWithEmailAndPasswordAsync(email, password);

            var token = await user.User.GetTokenAsync(false);

            return(token.Token);
        }
コード例 #26
0
    public void Signup(string username, string email, string password)
    {
        Debug.LogError("sign up nw.");
        loadingprefab.SetActive(true);


        if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
        {
            //Error handling
            return;
        }


        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                ErrorText.enabled = true;
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                ErrorText.enabled = true;
                Debug.LogError("CreateUserWithEmailAndPasswordAsync error: " + task.Exception);
                if (task.Exception.InnerExceptions.Count > 0)
                {
                    //   UpdateErrorMessage(task.Exception.InnerExceptions[0].Message);
                    return;
                }
            }

            FirebaseUser newUser = task.Result; // Firebase user has been created.
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            Debug.LogError(newUser.UserId);

            // User Create in db
            Debug.LogError("user added start");

            User user   = new User(username, email, password);
            string json = JsonUtility.ToJson(user);

            DatabaseReference reference = FirebaseDatabase.DefaultInstance.GetReference("Users");

            reference.Child(newUser.UserId).SetRawJsonValueAsync(json);
            Debug.LogError("user added");
            ErrorText.enabled = false;
            loadingprefab.SetActive(false);


            SceneManager.LoadScene("ResultScene");


            //  UpdateErrorMessage("Signup Success");
        });
    }
コード例 #27
0
ファイル: LoginMng.cs プロジェクト: jhj000213/AlggaO
    public void CreateUser()
    {
        if (_PasswordField_Account.text.Length < 6)
        {
            _SceneMng.OpenTextLogPopup("비밀번호는 6자이상이어야 합니다");
            return;
        }
        else if (_NicknameField.text == "")
        {
            _SceneMng.OpenTextLogPopup("닉네임을 입력하세요");
            return;
        }
        else if (_NicknameField.text.Length >= 9)
        {
            _SceneMng.OpenTextLogPopup("닉네임은 8자이하이어야 합니다");
            return;
        }
        else if (_EmailField_Account.text == "")
        {
            _SceneMng.OpenTextLogPopup("이메일을 입력하세요");
            return;
        }
        else if (!_EmailField_Account.text.Contains("@"))
        {
            _SceneMng.OpenTextLogPopup("이메일 형식으로 작성해주세요");
            return;
        }
        auth.CreateUserWithEmailAndPasswordAsync(_EmailField_Account.text, _PasswordField_Account.text).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.Log("CreateUserWithEmailAndPasswordAsync was canceled.");
                _SceneMng.OpenQuitPopup();
                return;
            }
            if (task.IsFaulted)
            {
                Debug.Log("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                _SceneMng.OpenQuitPopup();
                return;
            }

            FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);


            User user   = new User(_NicknameField.text, newUser.Email);
            string json = JsonUtility.ToJson(user);
            databaseReference.Child("users").Child(newUser.UserId).SetRawJsonValueAsync(json);

            Debug.Log("CreateUser Complete");
            LoginUser_NextAccount();
            UserLoginCheck();
        });
    }
コード例 #28
0
        public async Task <string> registerWithEmailPassword(string email, string password)
        {
            mAuth = FirebaseAuth.Instance;
            IAuthResult result = await mAuth.CreateUserWithEmailAndPasswordAsync(email, password);

            var token = await result.User.GetIdTokenAsync(false);

            Xamarin.Forms.Application.Current.Properties["uid"] = result.User.Uid;
            return(token.Token);

            Console.WriteLine(result);
        }
コード例 #29
0
        void createUser()
        {
            var email    = $"{DisplayName}@reticle.local";
            var password = $"{email}{email.GetHashCode()}";

            Debug.Log($"[EmailAuth::createUser] Creating {DisplayName} / {email}");

            var credential = EmailAuthProvider.GetCredential(email, password);

            _auth.CreateUserWithEmailAndPasswordAsync(email, password)
            .ContinueWithOnMainThread(handleSignInWithUser);
        }
コード例 #30
0
    // Sign Up user in Database
    public void Signup(string email, string password, string name)
    {
        if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password) || string.IsNullOrWhiteSpace(name))
        {
            //Error handling
            return;
        }

        // PlayerPrefs.SetString("U_EMAIL", email);
        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync error: " + task.Exception);
                if (task.Exception.InnerExceptions.Count > 0)
                {
                    UpdateErrorMessage(task.Exception.InnerExceptions[0].Message);
                }
                return;
            }

            FirebaseUser newUser = task.Result; // Firebase user has been created.
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            UpdateErrorMessage("Signup Success");

            // PlayerPrefs.SetString("U_EMAIL", newUser != null ? newUser.Email : "Unknown");
            // PlayerPrefs.SetString("U_PASS", newUser != null ? PasswordInput : "Unknown");
            PlayerPrefs.SetString("U_ID", newUser != null ? newUser.UserId : "Unknown");

            //Set Default Score to 0
            PlayerPrefs.SetInt("U_SCORE", 0);
            // Set How to Play panel active (First time User)
            PlayerPrefs.SetInt("U_TUTORIAL", 1);

            // Update User's Name
            UpdateName();

            PlayerPrefs.SetString("U_NAME", name);
            // var umail = PlayerPrefs.GetString("U_EMAIL");

            Debug.Log("--------------Creds------------------ \n" + email + "  " + name + "  " + PlayerPrefs.GetString("U_ID"));

            // LogIn User
            Login(email, "viruswarrior");
        });
    }