コード例 #1
0
        public PhoneNumberViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = stateService.Password;
            stateService.Password = null;

            _authorizationForm             = stateService.AuthorizationForm;
            stateService.AuthorizationForm = null;

            _secureValues             = stateService.SecureValues;
            stateService.SecureValues = null;

            _secureType             = stateService.SecureType;
            stateService.SecureType = null;

            _secureRequiredType             = stateService.SecureRequiredType;
            stateService.SecureRequiredType = null;

            var user = CacheService.GetUser(new TLInt(StateService.CurrentUserId));

            if (user != null && user.HasPhone)
            {
                CurrentPhone = user.Phone.ToString();
            }

            _phoneNumberValue = _secureRequiredType != null ? _secureRequiredType.DataValue : null;
        }
コード例 #2
0
        public EmailCodeViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = stateService.Password;
            stateService.Password = null;

            _authorizationForm             = stateService.AuthorizationForm;
            stateService.AuthorizationForm = null;

            _secureValues             = stateService.SecureValues;
            stateService.SecureValues = null;

            _secureType             = stateService.SecureType;
            stateService.SecureType = null;

            _secureRequiredType             = stateService.SecureRequiredType;
            stateService.SecureRequiredType = null;

            CurrentEmail = stateService.CurrentEmail;
            stateService.CurrentEmail = null;

            _emailValue = _secureRequiredType != null ? _secureRequiredType.DataValue : null;

            _sentCode = stateService.SentEmailCode;
            stateService.SentEmailCode = null;

            Subtitle = GetSubtitle();

            var length = _sentCode as ILength;

            CodeLength = length != null ? length.Length.Value : Constants.DefaultCodeLength;
        }
コード例 #3
0
        public EmailViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = stateService.Password;
            stateService.Password = null;

            _authorizationForm             = stateService.AuthorizationForm;
            stateService.AuthorizationForm = null;

            _secureValues             = stateService.SecureValues;
            stateService.SecureValues = null;

            _secureType             = stateService.SecureType;
            stateService.SecureType = null;

            _secureRequiredType             = stateService.SecureRequiredType;
            stateService.SecureRequiredType = null;

            var password = _passwordBase as TLPassword81;

            if (password != null)
            {
                var passwordSettings = password.Settings as TLPasswordSettings83;
                if (passwordSettings != null)
                {
                    CurrentEmail = TLString.IsNullOrEmpty(passwordSettings.Email)? string.Empty : passwordSettings.Email.ToString();
                }
            }

            _emailValue = _secureRequiredType != null ? _secureRequiredType.DataValue : null;
        }
コード例 #4
0
        private void OnCheckPasswordSettings(object sender, System.EventArgs e)
        {
            Execute.ShowDebugMessage("account.getPasswordSettings");

            MTProtoService.GetPasswordAsync(
                result => BeginOnUIThread(() =>
            {
                var password = result as TLPassword;
                if (password != null && password.HasRecovery.Value)
                {
                    var currentPassword = _password as TLPassword;
                    if (currentPassword != null)
                    {
                        password.CurrentPasswordHash = currentPassword.CurrentPasswordHash;
                    }

                    _password = password;

                    RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                    NotifyOfPropertyChange(() => RecoveryEmailLabel);
                    NotifyOfPropertyChange(() => CompletePasswordLabel);
                    NotifyOfPropertyChange(() => ChangePasswordVisibility);
                    NotifyOfPropertyChange(() => CompletePasswordVisibility);

                    StopTimer();
                }
            }),
                error =>
            {
                Execute.ShowDebugMessage("account.getPasswordSettings error " + error);
            });
        }
コード例 #5
0
        public PasswordViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _checkPasswordSettingsTimer.Tick    += OnCheckPasswordSettings;
            _checkPasswordSettingsTimer.Interval = TimeSpan.FromSeconds(5.0);

            _password             = StateService.Password;
            StateService.Password = null;
            if (_password != null)
            {
                PasswordEnabled = _password.IsAvailable;
                RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                    ? Visibility.Visible
                    : Visibility.Collapsed;
            }

            PropertyChanged += (o, e) =>
            {
                if (Property.NameEquals(e.PropertyName, () => PasswordEnabled) && !_suppressPasswordEnabled)
                {
                    if (PasswordEnabled)
                    {
                        ChangePassword();
                    }
                    else
                    {
                        ClearPassword();
                    }
                }
            };
        }
コード例 #6
0
        private void OnCheckPasswordSettings(object sender, System.EventArgs e)
        {
            Execute.ShowDebugMessage("account.getPasswordSettings");

            MTProtoService.GetPasswordAsync(
                result => BeginOnUIThread(() =>
            {
                var password84 = result as TLPassword84;
                if (password84 != null && password84.HasRecovery.Value)
                {
                    var algo = password84.CurrentAlgo as TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
                    if (algo == null)
                    {
                        return;
                    }

                    password84.CurrentPasswordHash = SRP.GetX(new TLString(TempNewPassword), algo);
                    //password.CurrentPasswordHash = Utils.Password.GetHash(password.CurrentSalt, new TLString(TempNewPassword));

                    _password = password84;

                    RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                    NotifyOfPropertyChange(() => RecoveryEmailLabel);
                    NotifyOfPropertyChange(() => CompletePasswordLabel);
                    NotifyOfPropertyChange(() => ChangePasswordVisibility);
                    NotifyOfPropertyChange(() => CompletePasswordVisibility);

                    StopTimer();

                    if (_authorizationForm != null || _secureValues != null)
                    {
                        MTProtoService.GetPasswordSettingsAsync(SRP.GetCheck(password84.CurrentPasswordHash, password84.SRPId, password84.SRPB, algo),
                                                                result2 => BeginOnUIThread(() =>
                        {
                            Passport.EnterPasswordViewModel.NavigateToPassportCommon(
                                result2, password84, new TLString(TempNewPassword),
                                _authorizationForm, _secureValues,
                                MTProtoService, StateService, NavigationService);
                        }),
                                                                error => BeginOnUIThread(() =>
                        {
                            if (error.TypeEquals(ErrorType.PASSWORD_HASH_INVALID))
                            {
                                StateService.AuthorizationForm = _authorizationForm;
                                StateService.Password          = result;
                                NavigationService.UriFor <Passport.EnterPasswordViewModel>().WithParam(x => x.RandomParam, Guid.NewGuid().ToString()).Navigate();
                            }
                        }));
                    }
                }
            }),
                error =>
            {
                Execute.ShowDebugMessage("account.getPasswordSettings error " + error);
            });
        }
コード例 #7
0
        public ChangePasswordEmailViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = StateService.Password;
            StateService.Password = null;

            _newPasswordSettings             = StateService.NewPasswordSettings;
            StateService.NewPasswordSettings = null;
        }
コード例 #8
0
        public PasswordIntroViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = StateService.Password;
            StateService.Password = null;

            _authorizationForm             = StateService.AuthorizationForm;
            StateService.AuthorizationForm = null;

            _secureValues             = StateService.SecureValues;
            StateService.SecureValues = null;
        }
コード例 #9
0
        protected ChangePasswordViewModelBase(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = StateService.Password;
            StateService.Password = null;

            _newPasswordSettings             = StateService.NewPasswordSettings;
            StateService.NewPasswordSettings = null;

            _authorizationForm             = StateService.AuthorizationForm;
            StateService.AuthorizationForm = null;

            _secureValues             = StateService.SecureValues;
            StateService.SecureValues = null;
        }
コード例 #10
0
        public PassportSettingsViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = stateService.Password;
            stateService.Password = null;

            Items.Clear();
            if (stateService.SecureValues != null)
            {
                Items.AddRange(stateService.SecureValues);
                stateService.SecureValues = null;
            }

            EventAggregator.Subscribe(this);
        }
コード例 #11
0
ファイル: Password.cs プロジェクト: yuukidesu9/telegram-wp
        public static TLString GetHash(TLPasswordBase passwordBase, TLString pwd)
        {
            var password83 = passwordBase as TLPassword83;

            if (password83 != null)
            {
                return(GetNewHash(password83.CurrentAlgo, pwd));
            }

            var password = passwordBase as TLPassword;

            if (password != null)
            {
                return(GetHash(password.CurrentSalt, pwd));
            }

            return(null);
        }
コード例 #12
0
        protected override void OnActivate()
        {
            StartTimer();

            if (StateService.RemoveBackEntry)
            {
                StateService.RemoveBackEntry = false;
                NavigationService.RemoveBackEntry();
            }

            if (StateService.Password == null)
            {
                _suppressPasswordEnabled = true;
                if (_password != null)
                {
                    PasswordEnabled = _password.IsAvailable;
                    RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                        ? Visibility.Visible
                        : Visibility.Collapsed;
                    NotifyOfPropertyChange(() => RecoveryEmailLabel);
                    NotifyOfPropertyChange(() => CompletePasswordLabel);
                    NotifyOfPropertyChange(() => ChangePasswordVisibility);
                    NotifyOfPropertyChange(() => CompletePasswordVisibility);
                }
                _suppressPasswordEnabled = false;
            }
            else
            {
                _password             = StateService.Password;
                StateService.Password = null;

                StartTimer();

                RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                     ? Visibility.Visible
                     : Visibility.Collapsed;
                NotifyOfPropertyChange(() => RecoveryEmailLabel);
                NotifyOfPropertyChange(() => CompletePasswordLabel);
                NotifyOfPropertyChange(() => ChangePasswordVisibility);
                NotifyOfPropertyChange(() => CompletePasswordVisibility);
            }

            base.OnActivate();
        }
コード例 #13
0
        public ChangePasswordHintViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = StateService.Password;
            StateService.Password = null;

            _newSettings = StateService.NewPasswordSettings;
            StateService.NewPasswordSettings = null;

            if (_passwordBase != null &&
                !string.IsNullOrEmpty(_passwordBase.TempNewPassword) &&
                _passwordBase.TempNewPassword.Length > 2)
            {
                PasswordHint = string.Format("{0}{1}{2}",
                                             _passwordBase.TempNewPassword[0],
                                             new String('*', _passwordBase.TempNewPassword.Length - 2),
                                             _passwordBase.TempNewPassword[_passwordBase.TempNewPassword.Length - 1]);
            }
        }
コード例 #14
0
        public PhoneNumberCodeViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _passwordBase         = stateService.Password;
            stateService.Password = null;

            _authorizationForm             = stateService.AuthorizationForm;
            stateService.AuthorizationForm = null;

            _secureValues             = stateService.SecureValues;
            stateService.SecureValues = null;

            _secureType             = stateService.SecureType;
            stateService.SecureType = null;

            _secureRequiredType             = stateService.SecureRequiredType;
            stateService.SecureRequiredType = null;

            _phoneNumberValue = _secureRequiredType != null ? _secureRequiredType.DataValue : null;

            _type             = stateService.Type;
            stateService.Type = null;

            _nextType             = stateService.NextType;
            stateService.NextType = null;

            Subtitle = GetSubtitle();

            var length = _type as ILength;

            CodeLength = length != null ? length.Length.Value : Constants.DefaultCodeLength;

            Timeout = stateService.SendCallTimeout;
            ResendCodeVisibility = stateService.SendCallTimeout != null && stateService.SendCallTimeout.Value > 0
                ? Visibility.Collapsed
                : Visibility.Visible;

            SuppressUpdateStatus = true;

            EventAggregator.Subscribe(this);

            PropertyChanged += (sender, args) =>
            {
                if (Property.NameEquals(args.PropertyName, () => Code))
                {
                    NotifyOfPropertyChange(() => CanConfirm);

                    if (!string.IsNullOrEmpty(Code) && Code.Length == CodeLength)
                    {
                        Confirm();
                    }
                }
            };

            _callTimer.Tick += (sender, args) =>
            {
                _timeCounter = Timeout == null? 0 : (int)(Timeout.Value - (DateTime.Now - _startTime).TotalSeconds);

                if (_timeCounter > 0)
                {
#if DEBUG
                    TimeCounterString = _timeCounter.ToString(CultureInfo.InvariantCulture);
#endif

                    if (_nextType is TLCodeTypeCall)
                    {
                        TimeCounterString = string.Format(AppResources.WeWillCallYou, TimeSpan.FromSeconds(TimeCounter).ToString(@"m\:ss"));
                    }
                }
                else
                {
                    _timeCounter = 0;
                    if (_nextType is TLCodeTypeCall)
                    {
                        TimeCounterString = AppResources.TelegramDialedYourNumber;
                    }

                    HelpVisibility       = Visibility.Visible;
                    ResendCodeVisibility = Visibility.Visible;
                    _callTimer.Stop();
                }

                NotifyOfPropertyChange(() => TimeCounter);
            };
        }
コード例 #15
0
        private void ClearPassword()
        {
            var password = _password as TLPassword84;

            if (password == null)
            {
                return;
            }

            IsWorking = true;
            BeginOnThreadPool(() =>
            {
                var newSettings = new TLPasswordInputSettings83
                {
                    Flags           = new TLInt(0),
                    NewAlgo         = new TLPasswordKdfAlgoUnknown(),
                    NewPasswordHash = TLString.Empty,
                    Hint            = TLString.Empty,
                    Email           = TLString.Empty
                };

                MTProtoService.GetPasswordAsync(
                    result1 =>
                {
                    var srpParams = result1 as IPasswordSRPParams;
                    if (srpParams == null)
                    {
                        BeginOnUIThread(() => IsWorking = false);
                        return;
                    }

                    var currentPasswordHash = password.CurrentPasswordHash ?? TLString.Empty;
                    MTProtoService.UpdatePasswordSettingsAsync(SRP.GetCheck(currentPasswordHash, srpParams.SRPId, srpParams.SRPB, srpParams.CurrentAlgo), newSettings,
                                                               result => BeginOnUIThread(() =>
                    {
                        StopTimer();

                        IsWorking      = false;
                        var noPassword = new TLPassword84
                        {
                            Flags = new TLInt(0),
                            EmailUnconfirmedPattern = TLString.Empty,
                            NewSecureSalt           = TLString.Empty,
                            SecretRandom            = TLString.Empty
                        };

                        var password81 = _password as TLPassword84;
                        if (password81 != null)
                        {
                            noPassword.NewAlgo       = password81.NewAlgo;
                            noPassword.NewSecureSalt = password81.NewSecureSalt;
                            noPassword.SecretRandom  = password81.SecretRandom;
                        }

                        _password = noPassword;
                        if (_password != null)
                        {
                            PasswordEnabled = _password.IsAvailable;
                            RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                                        ? Visibility.Visible
                                        : Visibility.Collapsed;
                            NotifyOfPropertyChange(() => RecoveryEmailLabel);
                            NotifyOfPropertyChange(() => CompletePasswordLabel);
                            NotifyOfPropertyChange(() => ChangePasswordVisibility);
                            NotifyOfPropertyChange(() => CompletePasswordVisibility);
                        }
                        EventAggregator.Publish(_password);
                    }),
                                                               error => BeginOnUIThread(() =>
                    {
                        IsWorking          = false;
                        var messageBuilder = new StringBuilder();
                        //messageBuilder.AppendLine(AppResources.ServerErrorMessage);
                        //messageBuilder.AppendLine();
                        messageBuilder.AppendLine("Method: account.updatePasswordSettings");
                        messageBuilder.AppendLine("Result: " + error);

                        if (TLRPCError.CodeEquals(error, ErrorCode.FLOOD))
                        {
                            Execute.BeginOnUIThread(() => MessageBox.Show(AppResources.FloodWaitString, AppResources.Error, MessageBoxButton.OK));
                        }
                        else if (TLRPCError.CodeEquals(error, ErrorCode.INTERNAL))
                        {
                            Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.ServerError, MessageBoxButton.OK));
                        }
                        else if (TLRPCError.CodeEquals(error, ErrorCode.BAD_REQUEST))
                        {
                            if (TLRPCError.TypeEquals(error, ErrorType.PASSWORD_HASH_INVALID))
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                            }
                            else if (TLRPCError.TypeEquals(error, ErrorType.NEW_PASSWORD_BAD))
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                            }
                            else if (TLRPCError.TypeEquals(error, ErrorType.NEW_SALT_INVALID))
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                            }
                            else if (TLRPCError.TypeEquals(error, ErrorType.EMAIL_INVALID))
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(AppResources.EmailInvalid, AppResources.Error, MessageBoxButton.OK));
                            }
                            else if (TLRPCError.TypeEquals(error, ErrorType.EMAIL_UNCONFIRMED))
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                            }
                            else
                            {
                                Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                            }
                        }
                        else
                        {
                            Execute.ShowDebugMessage("account.updatePasswordSettings error " + error);
                        }
                    }));
                },
                    error1 => BeginOnUIThread(() =>
                {
                    IsWorking = false;
                }));
            });
        }
コード例 #16
0
        private void ClearPassword()
        {
            TLString currentPasswordHash;
            TLPasswordInputSettings newSettings;
            var password = _password as TLPassword;

            if (password != null)
            {
                currentPasswordHash = password.CurrentPasswordHash;
                newSettings         = new TLPasswordInputSettings
                {
                    NewSalt         = TLString.Empty,
                    NewPasswordHash = TLString.Empty,
                    Hint            = TLString.Empty,
                    Email           = TLString.Empty
                };
            }
            else
            {
                currentPasswordHash = TLString.Empty;
                newSettings         = new TLPasswordInputSettings
                {
                    Email = TLString.Empty
                };
            }

            IsWorking = true;
            MTProtoService.UpdatePasswordSettingsAsync(currentPasswordHash, newSettings,
                                                       result => BeginOnUIThread(() =>
            {
                StopTimer();

                IsWorking = false;
                _password = new TLNoPassword {
                    NewSalt = _password.NewSalt, EmailUnconfirmedPattern = TLString.Empty
                };
                if (_password != null)
                {
                    PasswordEnabled = _password.IsAvailable;
                    RecoveryEmailUnconfirmedVisibility = !TLString.IsNullOrEmpty(_password.EmailUnconfirmedPattern) || (_password is TLPassword && ((TLPassword)_password).HasRecovery.Value)
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                    NotifyOfPropertyChange(() => RecoveryEmailLabel);
                    NotifyOfPropertyChange(() => CompletePasswordLabel);
                    NotifyOfPropertyChange(() => ChangePasswordVisibility);
                    NotifyOfPropertyChange(() => CompletePasswordVisibility);
                }
            }),
                                                       error => BeginOnUIThread(() =>
            {
                IsWorking          = false;
                var messageBuilder = new StringBuilder();
                //messageBuilder.AppendLine(AppResources.ServerErrorMessage);
                //messageBuilder.AppendLine();
                messageBuilder.AppendLine("Method: account.updatePasswordSettings");
                messageBuilder.AppendLine("Result: " + error);

                if (TLRPCError.CodeEquals(error, ErrorCode.FLOOD))
                {
                    Execute.BeginOnUIThread(() => MessageBox.Show(AppResources.FloodWaitString, AppResources.Error, MessageBoxButton.OK));
                }
                else if (TLRPCError.CodeEquals(error, ErrorCode.INTERNAL))
                {
                    Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.ServerError, MessageBoxButton.OK));
                }
                else if (TLRPCError.CodeEquals(error, ErrorCode.BAD_REQUEST))
                {
                    if (TLRPCError.TypeEquals(error, ErrorType.PASSWORD_HASH_INVALID))
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                    }
                    else if (TLRPCError.TypeEquals(error, ErrorType.NEW_PASSWORD_BAD))
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                    }
                    else if (TLRPCError.TypeEquals(error, ErrorType.NEW_SALT_INVALID))
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                    }
                    else if (TLRPCError.TypeEquals(error, ErrorType.EMAIL_INVALID))
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(AppResources.EmailInvalid, AppResources.Error, MessageBoxButton.OK));
                    }
                    else if (TLRPCError.TypeEquals(error, ErrorType.EMAIL_UNCONFIRMED))
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                    }
                    else
                    {
                        Execute.BeginOnUIThread(() => MessageBox.Show(messageBuilder.ToString(), AppResources.Error, MessageBoxButton.OK));
                    }
                }
                else
                {
                    Execute.ShowDebugMessage("account.updatePasswordSettings error " + error);
                }
            }));
        }