<commit_before>#
# Redirects back based on query params, session, or w/e else.
# Code stolen from Force, thanks @dzucconi!
#
opts = require '../options'
sanitizeRedirect = require './sanitize_redirect'

module.exports = (req, res) ->
  url = sanitizeRedirect(
    (opts.afterSignupPagePath if req.artsyPassportSignedUp and !req.session.skipOnboarding) or
    req.body['redirect-to'] or
    req.query['redirect-to'] or
    req.params.redirect_uri or
    req.session.redirectTo or
    '/'
  )
  res?.redirect url
  return url<commit_msg>delete session data before redirecting<commit_after>#
# Redirects back based on query params, session, or w/e else.
# Code stolen from Force, thanks @dzucconi!
#
opts = require '../options'
sanitizeRedirect = require './sanitize_redirect'

module.exports = (req, res) ->
  url = sanitizeRedirect(
    (opts.afterSignupPagePath if req.artsyPassportSignedUp and !req.session.skipOnboarding) or
    req.body['redirect-to'] or
    req.query['redirect-to'] or
    req.params.redirect_uri or
    req.session.redirectTo or
    '/'
  )
  delete req.session.redirectTo
  delete req.session.skipOnboarding
  res?.redirect url
  return url
{'fraction_non_alphanumeric': 0.1117798796216681, 'fraction_numerical': 0.0, 'mean_word_length': 3.8702928870292888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4709938', 'n_tokens_mistral': 372, 'n_tokens_neox': 370, 'n_words': 99}