Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate to Login screen after ResetPassword and Signup events #369

Merged
merged 3 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lock/DatabaseForgotPasswordPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class DatabaseForgotPasswordPresenter: Presentable, Loggable {
} else {
let message = "We've just sent you an email to reset your password".i18n(key: "com.auth0.lock.database.forgot.success.message", comment: "forgot password email sent")
self.messagePresenter?.showSuccess(message)
guard !self.options.allow.contains(.Login) else { return self.navigator.navigate(.root) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better use of guard is to remove the unnecessary or uncommon branches of a flow. In this case the odd branch is when login is not allowed so we can either return nothing or do an old-fashioned else since it's more readable for this case because of the double negation.

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Lock/DatabasePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class DatabasePresenter: Presentable, Loggable {
guard createError != nil || loginError != nil else {
if !self.options.loginAfterSignup {
let message = "Thanks for signing up.".i18n(key: "com.auth0.lock.database.signup.success.message", comment: "User signed up")
if let databaseView = self.databaseView {
if let databaseView = self.databaseView, self.options.allow.contains(.Login) {
self.showLogin(inView: databaseView, identifier: self.creator.identifier)
}
self.messagePresenter?.showSuccess(message)
Expand Down