mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Password reset fixes
This commit is contained in:
parent
6dc3962307
commit
862eb86cae
@ -49,6 +49,8 @@ public final class TwoFactorDataInputScreen: ViewController {
|
||||
private let mode: TwoFactorDataInputMode
|
||||
private let stateUpdated: (SetupTwoStepVerificationStateUpdate) -> Void
|
||||
private let actionDisposable = MetaDisposable()
|
||||
|
||||
public var passwordRecoveryFailed: (() -> Void)?
|
||||
|
||||
public init(sharedContext: SharedAccountContext, engine: SomeTelegramEngine, mode: TwoFactorDataInputMode, stateUpdated: @escaping (SetupTwoStepVerificationStateUpdate) -> Void, presentation: ViewControllerNavigationPresentation = .modalInLargeLayout) {
|
||||
self.sharedContext = sharedContext
|
||||
@ -516,7 +518,12 @@ public final class TwoFactorDataInputScreen: ViewController {
|
||||
})
|
||||
})]), in: .window(.root))
|
||||
case .unauthorized:
|
||||
strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_RecoveryFailed, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_RecoveryFailed, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.passwordRecoveryFailed?()
|
||||
})]), in: .window(.root))
|
||||
}
|
||||
default:
|
||||
break
|
||||
@ -959,9 +966,9 @@ private final class TwoFactorDataInputScreenNode: ViewControllerTracingNode, UIS
|
||||
self.scrollNode.canCancelAllTouchesInViews = true
|
||||
|
||||
switch mode {
|
||||
case .password, .passwordRecovery, .passwordRecoveryEmail, .emailAddress, .updateEmailAddress:
|
||||
case .password, .passwordRecovery, .emailAddress, .updateEmailAddress:
|
||||
self.monkeyNode = ManagedMonkeyAnimationNode()
|
||||
case .emailConfirmation:
|
||||
case .emailConfirmation, .passwordRecoveryEmail:
|
||||
if let path = getAppBundle().path(forResource: "TwoFactorSetupMail", ofType: "tgs") {
|
||||
let animatedStickerNode = AnimatedStickerNode()
|
||||
animatedStickerNode.setup(source: AnimatedStickerNodeLocalFileSource(path: path), width: 272, height: 272, playbackMode: .once, mode: .direct(cachePathPrefix: nil))
|
||||
@ -1268,7 +1275,7 @@ private final class TwoFactorDataInputScreenNode: ViewControllerTracingNode, UIS
|
||||
return
|
||||
}
|
||||
switch strongSelf.mode {
|
||||
case .password:
|
||||
case .password, .passwordRecovery:
|
||||
if strongSelf.inputNodes[1].isFocused {
|
||||
let maxWidth = strongSelf.inputNodes[1].bounds.width
|
||||
|
||||
@ -1363,7 +1370,7 @@ private final class TwoFactorDataInputScreenNode: ViewControllerTracingNode, UIS
|
||||
return
|
||||
}
|
||||
switch strongSelf.mode {
|
||||
case .password:
|
||||
case .password, .passwordRecovery:
|
||||
textHidden = !textHidden
|
||||
for node in strongSelf.inputNodes {
|
||||
node.updateTextHidden(textHidden)
|
||||
|
@ -557,6 +557,17 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
|
||||
controller = TwoFactorDataInputScreen(sharedContext: self.sharedContext, engine: .unauthorized(TelegramEngineUnauthorized(account: self.account)), mode: .passwordRecoveryEmail(emailPattern: emailPattern, mode: .notAuthorized(syncContacts: syncContacts)), stateUpdated: { _ in
|
||||
}, presentation: .default)
|
||||
}
|
||||
controller.passwordRecoveryFailed = { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
let _ = (strongSelf.account.postbox.transaction { transaction -> Void in
|
||||
if let state = transaction.getState() as? UnauthorizedAccountState, case let .passwordRecovery(hint, number, code, _, syncContacts) = state.contents {
|
||||
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: strongSelf.account.testingEnvironment, masterDatacenterId: strongSelf.account.masterDatacenterId, contents: .passwordEntry(hint: hint, number: number, code: code, suggestReset: true, syncContacts: syncContacts)))
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
return controller
|
||||
}
|
||||
|
||||
@ -773,7 +784,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
|
||||
}
|
||||
controllers.append(self.passwordEntryController(hint: hint, suggestReset: suggestReset, syncContacts: syncContacts))
|
||||
self.setViewControllers(controllers, animated: !self.viewControllers.isEmpty)
|
||||
case let .passwordRecovery(_, _, _, emailPattern, syncContacts):
|
||||
case let .passwordRecovery(hint, _, _, emailPattern, syncContacts):
|
||||
var controllers: [ViewController] = []
|
||||
if !self.otherAccountPhoneNumbers.1.isEmpty {
|
||||
controllers.append(self.splashController())
|
||||
|
@ -129,9 +129,9 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
|
||||
}
|
||||
|
||||
func forgotPressed() {
|
||||
if self.suggestReset {
|
||||
/*if self.suggestReset {
|
||||
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.TwoStepAuth_RecoveryFailed, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
} else if self.didForgotWithNoRecovery {
|
||||
} else*/ if self.didForgotWithNoRecovery {
|
||||
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
} else {
|
||||
self.forgot?()
|
||||
|
Loading…
x
Reference in New Issue
Block a user