private void SignUpUser(User newUser) { if (SentConfirmationCode(newUser)) { User registeredUser = UserManager.RegisterUser(newUser); if (registeredUser == null) { CustomBox.Message("username or password already used"); } else { SuccessfullyRegistered?.Invoke(this, registeredUser); Close(); return; } } else { foreach (var item in LabelTextBoxPairs) { item.Value.Clear(); } } }
bool ValidateChosenLanguages() { if (string.IsNullOrEmpty(ComparisonLanguageOneLabel.Text) || string.IsNullOrEmpty(ComparisonLanguageTwoLabel.Text)) { CustomBox.Message("Select both languages"); return(false); } return(true); }
private void ForgotYourPasswordButton_Click(object sender, EventArgs e) { string enteredEmail = CustomBox.Input("Enter your Email"); if (enteredEmail != null && enteredEmail.Contains('@')) { if (UserManager.PasswordRecovery(enteredEmail)) { CustomBox.Message($"Password successfully sent to: {enteredEmail}"); return; } } CustomBox.Message("Message could not be sent"); }
private bool SentConfirmationCode(User newUser) { string confirmationCode = Guid.NewGuid().ToString(); if (UserManager.SentMailAsync(newUser, "GitHab Application - Registration", $"Confirmation code - {confirmationCode}").Result) { if (CustomBox.Input($"Confirmation code sent to {newUser.Email}") == confirmationCode) { return(true); } else { CustomBox.Message("Confirmation code is incorrect"); } } else { CustomBox.Message("Message could not be sent"); } return(false); }