internal void SetErrors(DataSubmitErrorArgs dataSubmitErrorArgs) { if (!Dispatcher.CheckAccess()) Dispatcher.Invoke(new Action(() => SetErrors(dataSubmitErrorArgs))); else { ResetStatus(); bool foundError = false; if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("email")) { Email.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Email address in use"); foundError = true; } if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("username")) { Username.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Username already in use"); foundError = true; } if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.NotComplexEnough)) { Password.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Password is insecure"); foundError = true; } if (!foundError) { _validator.SetError("Unknown Error"); } } }
public bool LoginFailed(DataSubmitErrorArgs dataSubmissionErrors) { if (dataSubmissionErrors.HasErrorField("PasswordHash")) { Password.Password = ""; Validate(); return true; } else if (dataSubmissionErrors.HasError(DataSubmitErrorCode.DataIncomplete)) { Password.Password = ""; Username.Text = ""; Validate(); return true; } return false; }
internal void PromptSignup(DataSubmitErrorArgs dataSubmitErrorArgs = null) { ClearCurrentEngagement(); if (dataSubmitErrorArgs != null) { DashboardData.SignUpScreen.SetErrors(dataSubmitErrorArgs); } DashboardData.LoginState = LoginState.Signup; }
internal void LoginFailed(DataSubmitErrorArgs dataSubmissionErrors) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke((Action)(() => LoginFailed(dataSubmissionErrors))); } else { if (DashboardData.LoginScreen.LoginFailed(dataSubmissionErrors)) { Login(); } } }
private void OnSignupFailed(DataSubmitErrorArgs e) { if (_appContext.IsShuttingDown) return; EventHandler<DataSubmitErrorArgs> handler = SignupFailed; if (handler != null) handler(this, e); }
private void OnLoginFailed(String fieldName, DataSubmitErrorCode errorCode) { if (_appContext.IsShuttingDown) return; var error = new DataSubmitError() { FieldName = fieldName, ErrorCode = errorCode }; DataSubmitErrorArgs e = new DataSubmitErrorArgs() { SubmitErrors = { error } }; EventHandler<DataSubmitErrorArgs> handler = LoginFailed; if (handler != null) handler(this, e); }
public void Signup(String firstname, String lastname, String username, String password, String email, String location, bool supporter) { var request = new SignupRq { firstname = firstname.Trim(), lastname = lastname.Trim(), username = username.Trim(), password = password, email = email.Trim(), location = location.Trim(), supporter = supporter }; OnSigningUp(); try { _appContext.ConnectionManager.Connection.Request<SignupRq, SignupRs>(request); // we might be logged in as a guest if (IsLoggedIn) { Logout(); } Login(request.username, request.password); } catch (MessageException<SignupRs> ex) { var errors = new DataSubmitErrorArgs(); Logger.Warn("Failed to signup : " + ex.Message); if (ex.Response.signupErrors != null) { if (ex.Response.signupErrors.Contains(SignupRs.SignupErrorEmailAddressInUse)) { errors.SubmitErrors.Add(new DataSubmitError() { FieldName = "email", ErrorCode = DataSubmitErrorCode.InUse }); } if (ex.Response.signupErrors.Contains(SignupRs.SignupErrorEmailAddressInvalid)) { errors.SubmitErrors.Add(new DataSubmitError() { FieldName = "email", ErrorCode = DataSubmitErrorCode.EmailInvalid }); } if (ex.Response.signupErrors.Contains(SignupRs.SignupErrorUserExists)) { errors.SubmitErrors.Add(new DataSubmitError() { FieldName = "username", ErrorCode = DataSubmitErrorCode.InUse }); } if (ex.Response.signupErrors.Contains(SignupRs.SignupErrorPasswordComplexity)) { errors.SubmitErrors.Add(new DataSubmitError() { FieldName = "password", ErrorCode = DataSubmitErrorCode.NotComplexEnough }); } } OnSignupFailed(errors); } catch (Exception ex) { Logger.Warn("Failed to signup : " + ex.Message); OnSignupFailed(new DataSubmitErrorArgs()); } }
private void LoginManagerOnSignupFailed(object sender, DataSubmitErrorArgs dataSubmitErrorArgs) { if (GwupeClientAppContext.CurrentAppContext.IsShuttingDown) return; dashBoard.PromptSignup(dataSubmitErrorArgs); }
//public void GetFunctionChat(Function chat) //{ // _chat = chat; //} /* public void ReceiveNotificationChat(String message,string Flag) { switch (Flag) { case "ReceiveFileRequest": _chat * '. case "RDPRequest": _chat.LogRdpRequest(message); break; } }*/ //public void GetEngagement(Engagement engagement, EngagementWindow engagementWindow) //{ // _engagement = engagement; // _engagementWindow = engagementWindow; // } //public void ShowRDPTerminateButton() //{ // _engagementWindow.TerminateButtonVisibility = Visibility.Visible; //} //public void GetRemoteEngagement(Engagement engagement) //{ // _remoteEngagement = engagement; //} /* public void GetContactRating(int ContactsRating) { _contactsRating = ContactsRating; } public int SetContactRating() { return _contactsRating; }*/ //public Engagement GetSourceObject() //{ // return _engagement; //} private void LoginManagerOnLoginFailed(object sender, DataSubmitErrorArgs dataSubmitErrorArgs) { if (GwupeClientAppContext.CurrentAppContext.IsShuttingDown) return; Logger.Debug("Received a login error " + dataSubmitErrorArgs); dashBoard.LoginFailed(dataSubmitErrorArgs); }
public void PromptSignup(DataSubmitErrorArgs dataSubmitErrorArgs = null) { dashBoard.PromptSignup(dataSubmitErrorArgs); }