@collect_auth
def auth_register(auth):
 context = {}
 campaign = request.args.get('campaign')
 next_url = request.args.get('next')
 logout = request.args.get('logout')
 if (logout and (not next_url)):
  raise HTTPError(http.BAD_REQUEST)
 data = login_and_register_handler(auth, login=False, campaign=campaign, next_url=next_url, logout=logout)
 if (data['status_code'] == http.OK):
  if data['must_login_warning']:
   status.push_status_message(language.MUST_LOGIN, trust=False)
  destination = cas.get_login_url(data['next_url'])
  context['non_institution_login_url'] = destination
  context['login_url'] = destination
  context['institution_login_url'] = cas.get_login_url(data['next_url'], campaign='institution')
  context['campaign'] = data['campaign']
  return (context, http.OK)
 elif (data['status_code'] == http.FOUND):
  return redirect(data['next_url'])
 elif (data['status_code'] == 'auth_logout'):
  return auth_logout(redirect_url=data['next_url'])
 raise HTTPError(http.BAD_REQUEST)

@ collect_auth def auth_register ( auth ) : context = { } campaign = request . args . get ( 'campaign' ) next_url = request . args . get ( 'next' ) logout = request . args . get ( 'logout' ) if ( logout and ( not next_url ) ) : raise HTTPError ( http . BAD_REQUEST ) data = login_and_register_handler ( auth , login = False , campaign = campaign , next_url = next_url , logout = logout ) if ( data [ 'status_code' ] == http . OK ) : if data [ 'must_login_warning' ] : status . push_status_message ( language . MUST_LOGIN , trust = False ) destination = cas . get_login_url ( data [ 'next_url' ] ) context [ 'non_institution_login_url' ] = destination context [ 'login_url' ] = destination context [ 'institution_login_url' ] = cas . get_login_url ( data [ 'next_url' ] , campaign = 'institution' ) context [ 'campaign' ] = data [ 'campaign' ] return ( context , http . OK ) elif ( data [ 'status_code' ] == http . FOUND ) : return redirect ( data [ 'next_url' ] ) elif ( data [ 'status_code' ] == 'auth_logout' ) : return auth_logout ( redirect_url = data [ 'next_url' ] ) raise HTTPError ( http . BAD_REQUEST )
view for osf register .