[#boost-urls-url-remove_password]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::remove&lowbar;password
:relfileprefix: ../../../
:mrdocs:

Remove the password

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L439[boost&sol;url&sol;url&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/url.adoc[url]&
remove&lowbar;password() noexcept;
----

== Description

This function removes the password from the userinfo if a password exists&period; If there is no userinfo or no authority, the call has no effect&period;

[NOTE]
The interpretation of the userinfo as individual user and password components is scheme&hyphen;dependent&period; Transmitting passwords in URLs is deprecated&period;

== 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&hyphen;&gt;size()`&period;

== Exception Safety
Throws nothing&period;

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

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )
----
== Specification
* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[]

== Return Value

`&ast;this`

== See Also

xref:boost/urls/url/set_encoded_password.adoc[`set&lowbar;encoded&lowbar;password`], xref:boost/urls/url/set_encoded_user.adoc[`set&lowbar;encoded&lowbar;user`], xref:boost/urls/url/set_password.adoc[`set&lowbar;password`], xref:boost/urls/url/set_user.adoc[`set&lowbar;user`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
