:relfileprefix: ../../../
[#boost-urls-static_url-remove_password]

= xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/static_url.adoc[pass:[static_url]]::remove_password


Remove the password


== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L371[boost/url/static_url.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/static_url.adoc[static_url]&
remove_password() noexcept;
----

== Description


This function removes the password from
the userinfo if a password exists. If
there is no userinfo or no authority,
the call has no effect.
[NOTE]

The interpretation of the userinfo as
individual user and password components
is scheme-dependent. Transmitting
passwords in URLs is deprecated.

=== Example
[,cpp]
----
assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );
----

=== Postconditions
[,cpp]
----
this->has_password() == false && this->encoded_password().empty() == true
----

=== Complexity

Linear in `this-&gt;size()`.

=== Exception Safety

Throws nothing.

=== BNF
[,cpp]
----
userinfo      = [ [ user ] [ ':' password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[            3.2.1. User Information (rfc3986)]








== See Also


xref:boost/urls/url_base/set_encoded_password.adoc[set_encoded_password]
,
xref:boost/urls/url_base/set_encoded_user.adoc[set_encoded_user]
,
xref:boost/urls/url_base/set_password.adoc[set_password]
,
xref:boost/urls/url_base/set_user.adoc[set_user]
.



