Esempio n. 1
0
        /// <summary>
        /// Triggered when change password is clicked; asks the server to change the password
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ButtonChangePassword_Clicked(object sender, EventArgs e)
        {
            this.ActivityIndicator.IsVisible = true;
            this.ActivityIndicator.IsRunning = true;
            if (this.EntryPassword.Text == this.EntryReenterPassword.Text && this.EntryPassword.Text.Length > minLength)
            {
                OperationReturnMessage message =
                    ServerOperations.ForgotPasswordChangePassword(this.username, this.EntryCode.Text.Trim(), this.EntryPassword.Text.Trim());
                if (message == OperationReturnMessage.True)
                {
                    await this.DisplayAlert("Password Changed", "Your password was sucessfully changed.", "Ok");

                    await this.Navigation.PopModalAsync();
                }
                else if (message == OperationReturnMessage.FalseInvalidCredentials)
                {
                    await this.DisplayAlert("Incorrect Code", "Your code was incorrect. Please try again.", "Ok");
                }
                else
                {
                    await this.DisplayAlert("Failed", "Your password change was failed. Please try again.", "Ok");
                }
            }
            else
            {
                await this.DisplayAlert("Invalid fields", "Passwords do not match or are not greater than five characters or less than 32 characters", "Ok");
            }
            this.ActivityIndicator.IsVisible = false;
            this.ActivityIndicator.IsRunning = false;
        }