mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 17:35:27 +08:00
Simplify redirect condition on account_activated
This commit is contained in:
parent
521f6b5822
commit
afb7f5ef42
1 changed files with 14 additions and 16 deletions
|
@ -16,19 +16,6 @@ class Browser(Enum):
|
|||
Other = 4
|
||||
|
||||
|
||||
def get_browser() -> Browser:
|
||||
user_agent = request.user_agent
|
||||
if user_agent.platform in ["android", "iphone", "ipad']:
|
||||
return Browser.Other
|
||||
if user_agent.browser == "edge":
|
||||
return Browser.Edge
|
||||
elif user_agent.browser in ["chrome", "opera", "webkit"]:
|
||||
return Browser.Chrome
|
||||
elif user_agent.browser in ["mozilla", "firefox"]:
|
||||
return Browser.Firefox
|
||||
return Browser.Other
|
||||
|
||||
|
||||
def is_mobile() -> bool:
|
||||
return request.user_agent.platform in [
|
||||
"android",
|
||||
|
@ -39,12 +26,23 @@ def is_mobile() -> bool:
|
|||
]
|
||||
|
||||
|
||||
def get_browser() -> Browser:
|
||||
if is_mobile():
|
||||
return Browser.Other
|
||||
|
||||
user_agent = request.user_agent
|
||||
if user_agent.browser == "edge":
|
||||
return Browser.Edge
|
||||
elif user_agent.browser in ["chrome", "opera", "webkit"]:
|
||||
return Browser.Chrome
|
||||
elif user_agent.browser in ["mozilla", "firefox"]:
|
||||
return Browser.Firefox
|
||||
return Browser.Other
|
||||
|
||||
|
||||
@onboarding_bp.route("/account_activated", methods=["GET"])
|
||||
@login_required
|
||||
def account_activated():
|
||||
if is_mobile():
|
||||
return redirect(url_for("dashboard.index"))
|
||||
|
||||
browser = get_browser()
|
||||
if browser == Browser.Chrome:
|
||||
extension_link = CHROME_EXTENSION_LINK
|
||||
|
|
Loading…
Reference in a new issue