public static bool Authenticate(Form owner, bool asAdmin, bool change) { try { using (PasswordForm form = new PasswordForm()) { form.IsInAdminContext = asAdmin; if (form.ShowDialog(owner) == DialogResult.OK) { form.AuthenticateInternal(); if (change) { ChangePassword(form, asAdmin); } return(true); } } return(false); } catch (Exception ex) { ex.ShowDialog(owner); return(false); } }
public static bool ChangePassword(Form owner, bool asAdmin) { try { using (PasswordForm form = new PasswordForm()) { form.IsInAdminContext = asAdmin; form.ChangePasswordAction = true; form.ShowCountries = true; if (form.ShowDialog(owner) == DialogResult.OK) { form.ChangePasswordInternal(owner); return(true); } } return(false); } catch (Exception ex) { ex.ShowDialog(owner); return(false); } }