Skip to content

Commit

Permalink
Merge pull request #754 from BryceStevenWilley/login_link_style_consi…
Browse files Browse the repository at this point in the history
…stent

Make "Sign up" & "Sign in" similar w/ login links
  • Loading branch information
jhpyle authored Apr 29, 2024
2 parents f14f56a + a674bbd commit 3a8a798
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docassemble_webapp/docassemble/webapp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,10 @@ def make_navbar(status, steps, show_login, chat_info, debug_mode, index_params,
custom_menu = ""
if ALLOW_REGISTRATION:
sign_in_text = word('Sign in or sign up to save answers')
if daconfig.get('resume interview after login', False):
register_url = url_for('user.register', next=url_for('index', **index_params))
else:
register_url = url_for('user.register')
else:
sign_in_text = word('Sign in to save answers')
if daconfig.get('resume interview after login', False):
Expand All @@ -3324,12 +3328,8 @@ def make_navbar(status, steps, show_login, chat_info, debug_mode, index_params,
else:
if daconfig.get('login link style', 'normal') == 'button':
if ALLOW_REGISTRATION:
if daconfig.get('resume interview after login', False):
register_url = url_for('user.register', next=url_for('index', **index_params))
else:
register_url = url_for('user.register')
navbar += ' <li class="nav-item"><a class="nav-link" href="' + register_url + '">' + word('Sign up') + '</a></li>'
navbar += ' <li class="nav-item"><a class="nav-link d-block d-md-none" href="' + login_url + '">' + word('Sign in') + '</a>'
navbar += ' <li class="nav-item"><a class="nav-link d-block d-md-none" href="' + register_url + '">' + word('Sign up') + '</a></li>'
navbar += ' <li class="nav-item"><a class="nav-link d-block d-md-none" href="' + login_url + '">' + word('Sign in') + '</a>'
else:
navbar += ' <li class="nav-item"><a class="nav-link" href="' + login_url + '">' + sign_in_text + '</a></li>'
elif current_user.is_authenticated:
Expand Down Expand Up @@ -3383,6 +3383,8 @@ def make_navbar(status, steps, show_login, chat_info, debug_mode, index_params,
navbar += """
</ul>"""
if daconfig.get('login link style', 'normal') == 'button' and show_login and current_user.is_anonymous and not custom_menu:
if ALLOW_REGISTRATION:
navbar += '\n <a class="btn btn-' + BUTTON_COLOR_NAV_LOGIN + ' btn-sm mb-0 ms-3 d-none d-md-block" href="' + register_url + '">' + word('Sign up') + '</a>'
navbar += '\n <a class="btn btn-' + BUTTON_COLOR_NAV_LOGIN + ' btn-sm mb-0 ms-3 d-none d-md-block" href="' + login_url + '">' + word('Sign in') + '</a>'
navbar += """
</div>"""
Expand Down

0 comments on commit 3a8a798

Please sign in to comment.