(request, domain, couch_user_id)
return HttpResponseRedirect(redirect)
phone_number cannot be passed in the url due to special characters
    but it can be passed as %-encoded GET parameters
phone_number cannot be passed in the url due to special characters
    but it can be passed as %-encoded GET parameters
phone_number cannot be passed in the url due to special characters but it can be passed as % - encoded GET parameters
def verify_phone_number(request, domain, couch_user_id):
    """
    phone_number cannot be passed in the url due to special characters
    but it can be passed as %-encoded GET parameters
    """
    if 'phone_number' not in request.GET:
        raise Http404('Must include phone number in request.')
    phone_number = six.moves.urllib.parse.unquote(request.GET['phone_number'])
    user = CouchUser.get_by_user_id(couch_user_id, domain)

    try:
        result = initiate_sms_verification_workflow(user, phone_number)
    except BadSMSConfigException as error:
        messages.error(request, _('Bad SMS configuration: {error}').format(error=error))
    else:
        if result == VERIFICATION__ALREADY_IN_USE:
            messages.error(request, _('Cannot start verification workflow. Phone number is already in use.'))
        elif result == VERIFICATION__ALREADY_VERIFIED:
            messages.error(request, _('Phone number is already verified.'))
        elif result == VERIFICATION__RESENT_PENDING:
            messages.success(request, _('Verification message resent.'))
        elif result == VERIFICATION__WORKFLOW_STARTED:
            messages.success(request, _('Verification workflow started.'))

    from corehq.apps.users.views.mobile import EditCommCareUserView
    redirect = reverse(EditCommCareUserView.urlname, args=[domain, couch_user_id])
    return HttpResponseRedirect(redirect)
def verify_phone_number ( request , domain , couch_user_id ) : if 'phone_number' not in request . GET : raise Http404 ( 'Must include phone number in request.' ) phone_number = six . moves . urllib . parse . unquote ( request . GET [ 'phone_number' ] ) user = CouchUser . get_by_user_id ( couch_user_id , domain ) try : result = initiate_sms_verification_workflow ( user , phone_number ) except BadSMSConfigException as error : messages . error ( request , _ ( 'Bad SMS configuration: {error}' ) . format ( error = error ) ) else : if result == VERIFICATION__ALREADY_IN_USE : messages . error ( request , _ ( 'Cannot start verification workflow. Phone number is already in use.' ) ) elif result == VERIFICATION__ALREADY_VERIFIED : messages . error ( request , _ ( 'Phone number is already verified.' ) ) elif result == VERIFICATION__RESENT_PENDING : messages . success ( request , _ ( 'Verification message resent.' ) ) elif result == VERIFICATION__WORKFLOW_STARTED : messages . success ( request , _ ( 'Verification workflow started.' ) ) from corehq . apps . users . views . mobile import EditCommCareUserView redirect = reverse ( EditCommCareUserView . urlname , args = [ domain , couch_user_id ] ) return HttpResponseRedirect ( redirect )