예제 #1
0
        private async void LoginButton_Click(object sender, System.EventArgs e)
        {
            if (CanUseFingerprint())
            {
                LogUserIn();
            }
            else
            {
                _userId = await DeliveryPerson.Login(_emailEditText.Text, _passwordEditText.Text);

                if (!string.IsNullOrEmpty(_userId))
                {
                    var preferencesEditor = _preferences.Edit();
                    preferencesEditor.PutString("userId", _userId);
                    preferencesEditor.Apply();

                    var intent = new Intent(this, typeof(TabsActivity));
                    intent.PutExtra("userId", _userId);
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "Failure", ToastLength.Long).Show();
                }
            }
        }
예제 #2
0
        private async void TraditionalLogin()
        {
            var email    = emailTextField.Text;
            var password = passwordTextField.Text;

            UIAlertController alert = null;

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                alert = UIAlertController.Create("Ошибка", "Email и пароль не могут быть пустыми", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ок", UIAlertActionStyle.Default, null));
            }
            else
            {
                userId = await DeliveryPerson.Login(email, password);

                if (!string.IsNullOrEmpty(userId))
                {
                    NSUserDefaults.StandardUserDefaults.SetString(userId, "userId");
                    NSUserDefaults.StandardUserDefaults.Synchronize();
                    hasLoggedIn = true;
                    alert       = UIAlertController.Create("Операция выполнена", "Добро пожаловать", UIAlertControllerStyle.Alert);
                    PerformSegue("loginSegue", this);
                }
                else
                {
                    alert = UIAlertController.Create("Ошибка", "Попробуйте снова", UIAlertControllerStyle.Alert);
                }

                alert.AddAction(UIAlertAction.Create("Ок", UIAlertActionStyle.Default, null));
            }

            PresentViewController(alert, true, null);
        }
예제 #3
0
        private async void SigninButton_Click(object sender, System.EventArgs e)
        {
            var email    = emailEditText.Text;
            var password = passwordEditText.Text;

            var userId = await DeliveryPerson.Login(email, password);

            try
            {
                if (!string.IsNullOrEmpty(userId))
                {
                    Toast.MakeText(this, "Login Successful, Welcome!!", ToastLength.Long).Show();
                    var intent = new Intent(this, typeof(TabsActivity));
                    intent.PutExtra("userId", userId);
                    //var intent = new Intent(this, typeof(NewDeliveryActivity));
                    StartActivity(intent);

                    //Prevent from moving back to main_activity page(login page) after sign in
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, "Couldnot login, try again", ToastLength.Long).Show();
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "Login Credintal not correct, try again", ToastLength.Long).Show();
            }
        }
예제 #4
0
        private async void SigninButton_Click(object sender, System.EventArgs e)
        {
            bool canUseFingerprint = CanUseFingerprint();

            if (canUseFingerprint)
            {
                LogUserIn();
            }
            else
            {
                userId = await DeliveryPerson.Login(emailEditText.Text, passwordEditText.Text);

                if (!string.IsNullOrEmpty(userId))
                {
                    try
                    {
                        var preferencesEditor = preferences.Edit();
                        preferencesEditor.PutString("userId", userId);
                        preferencesEditor.Apply();
                    }
                    catch (Exception ex)
                    {
                    }
                    Intent intent = new Intent(this, typeof(TabsActivity));
                    intent.PutExtra("userId", userId);
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "Failure", ToastLength.Long).Show();
                }
            }
        }
예제 #5
0
        private async Task TraditionalLogin()
        {
            _userId = await DeliveryPerson.Login(UsernameTextField.Text, PasswordTextField.Text);

            if (!string.IsNullOrEmpty(_userId))
            {
                NSUserDefaults.StandardUserDefaults.SetString(_userId, "userId");
                NSUserDefaults.StandardUserDefaults.Synchronize();

                _hasLoggedIn = true;
                PerformSegue("LoginSegue", this);
            }
        }
예제 #6
0
        private async void SignInButton_Click(object sender, System.EventArgs e)
        {
            var userID = await DeliveryPerson.Login(emailEditText.Text, passwordEditText.Text);

            if (!string.IsNullOrEmpty(userID))
            {
                Intent intent = new Intent(this, typeof(TabsActivity));
                intent.PutExtra("userId", userID);
                StartActivity(intent);
            }
            else
            {
                Toast.MakeText(this, "Failure", ToastLength.Long).Show();
            }
        }
예제 #7
0
        private async void TraditionalLogin()
        {
            userId = await DeliveryPerson.Login(emailTextField.Text, passwordTextField.Text);

            if (string.IsNullOrEmpty(userId))
            {
            }
            else
            {
                NSUserDefaults.StandardUserDefaults.SetString(userId, "userId");
                NSUserDefaults.StandardUserDefaults.Synchronize();
                hasLoggedin = true;
                PerformSegue("loginSegue", this);
            }
        }
        /// <summary>
        /// Method to log in users by querying Azure db
        /// </summary>
        private async void ServerLogin()
        {
            deliveryPersonId = await DeliveryPerson.Login(emailTextField.Text, passwordTextField.Text);

            if (string.IsNullOrEmpty(deliveryPersonId))
            {
                BiometricsAuth();           // bespoke method here
            }
            else
            {
                NSUserDefaults.StandardUserDefaults.SetString(deliveryPersonId, "deliveryPersonId");
                NSUserDefaults.StandardUserDefaults.Synchronize(); // save/synchronise the log-in data
                hasLoggedIn = true;
                PerformSegue("tabSegue", this);                    // once signed-in, navigate to TabsActivity with Delivered/Waiting &c tabs
            }
        }
예제 #9
0
        private async void SignInButton_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            var deliveryPersonId = await DeliveryPerson.Login(emailEditText.Text, passwordEditText.Text);

            if (!String.IsNullOrEmpty(deliveryPersonId))
            {
                Intent intent = new Intent(this, typeof(TabsActivity)); // Intent, for passing values (not needed if just starting Activity)
                intent.PutExtra("deliveryPersonId", deliveryPersonId);  // key/value passed via Intent to next activity (GetStringExtra from there)
                //StartActivity(typeof(TabsActivity));
                StartActivity(intent);                                  // must use the PutExtra'd intent to pass on data
            }
            else
            {
                Toast.MakeText(this, "Sign-In Failure", ToastLength.Long).Show();
            }
        }
예제 #10
0
        private async void SignInButton_Click(object sender, EventArgs e)
        {
            var canUseFingerprint = CanUseFingerprint();

            if (canUseFingerprint)
            {
                LogUserIn();
            }
            else
            {
                var email    = _emailEditText.Text;
                var password = _passwordEditText.Text;

                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
                {
                    Toast.MakeText(this, "Email and password cannot be empty", ToastLength.Long).Show();
                }
                else
                {
                    _userId = await DeliveryPerson.Login(email, password);

                    if (!string.IsNullOrEmpty(_userId))
                    {
                        var preferencesEditor = _sharedPreferences.Edit();
                        preferencesEditor.PutString("userId", _userId);
                        preferencesEditor.Apply();


                        Toast.MakeText(this, "Login successful", ToastLength.Long).Show();
                        Intent intent = new Intent(this, typeof(TabsActivity));
                        intent.PutExtra("userId", _userId);
                        StartActivity(intent);
                        Finish();
                    }
                    else
                    {
                        Toast.MakeText(this, "Incorrect password", ToastLength.Long).Show();
                    }
                }
            }
        }
예제 #11
0
        private async void NormalLogin()
        {
            UIAlertController alert = null;

            UserId = await DeliveryPerson.Login(tfEmail.Text, tfPassword.Text);

            if (!string.IsNullOrEmpty(UserId))
            {
                NSUserDefaults.StandardUserDefaults.SetString(UserId, "userId");
                NSUserDefaults.StandardUserDefaults.Synchronize();
                isLogged = true;
                PerformSegue("sgeLogin", this);
                alert = UIAlertController.Create("Success", "Welcome back", UIAlertControllerStyle.Alert);
            }
            else
            {
                alert = UIAlertController.Create("Wrong", "Can't login, Please check your information", UIAlertControllerStyle.Alert);
            }
            alert.AddAction(UIAlertAction.Create("ok", UIAlertActionStyle.Default, null));
            PresentViewController(alert, true, null);
        }
예제 #12
0
        private async void SigninButton_Click(object sender, System.EventArgs e)
        {
            bool canUseFingerprint = CanUseFingerprint();

            if (canUseFingerprint)
            {
                LogUserIn();
            }
            else
            {
                var email    = emailEditText.Text;
                var password = passwordEditText.Text;

                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
                {
                    Toast.MakeText(this, "Email и пароль не могут быть пустыми", ToastLength.Long).Show();
                }
                else
                {
                    userId = await DeliveryPerson.Login(email, password);

                    if (!string.IsNullOrEmpty(userId))
                    {
                        var preferencesEditor = preferences.Edit();
                        preferencesEditor.PutString("userId", userId);
                        preferencesEditor.Apply();

                        Toast.MakeText(this, "Авторизация успешна", ToastLength.Long).Show();
                        Intent intent = new Intent(this, typeof(TabsActivity));
                        intent.PutExtra("userId", userId);
                        StartActivity(intent);
                        Finish();
                    }
                    else
                    {
                        Toast.MakeText(this, "Попробуйте снова", ToastLength.Long).Show();
                    }
                }
            }
        }
예제 #13
0
        private async void BtnSignIn_Click(object sender, System.EventArgs e)
        {
            bool canUse = CanUseFPM();

            if (canUse)
            {
                UserFPMLogin();
            }
            else
            {
                var email = etEmail.Text;
                var pass  = etPassword.Text;
                UserId = await DeliveryPerson.Login(email, pass);

                if (!string.IsNullOrEmpty(UserId))
                {
                    try
                    {
                        var editPreference = sharedPreferences.Edit();
                        editPreference.PutString("UserID", UserId);
                        editPreference.Apply();
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
                    }
                    Toast.MakeText(this, "User login", ToastLength.Long).Show();
                    Intent intent = new Intent(this, typeof(TabsActivity));
                    intent.PutExtra("UserId", UserId);
                    StartActivity(intent);
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, "incorrect email or password", ToastLength.Long).Show();
                }
            }
        }