You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by garrensmith <gi...@git.apache.org> on 2017/02/22 13:34:45 UTC

[GitHub] couchdb-fauxton pull request #862: handle username and passwords correctly w...

GitHub user garrensmith opened a pull request:

    https://github.com/apache/couchdb-fauxton/pull/862

    handle username and passwords correctly with base64 encoding

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/garrensmith/couchdb-fauxton replication-encode-passwords

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fauxton/pull/862.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #862
    
----
commit 3b6c4f51f2e16df190359a6ba86d4d5ea8d7b03b
Author: Garren Smith <ga...@gmail.com>
Date:   2017-02-22T13:34:06Z

    handle username and passwords correctly with base64 encoding

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request #862: handle username and passwords correctly w...

Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith closed the pull request at:

    https://github.com/apache/couchdb-fauxton/pull/862


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request #862: handle username and passwords correctly w...

Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/862#discussion_r102474542
  
    --- Diff: app/addons/replication/api.js ---
    @@ -41,6 +42,38 @@ export const getAuthHeaders = (username, password) => {
       };
     };
     
    +export const getCredentialsFromUrl = (url) => {
    +  const index = url.lastIndexOf('@');
    +  if (index === -1) {
    +    return {
    +      username: '',
    +      password: ''
    +    };
    +  }
    +
    +  const startIndex = url.startsWith("https") ? 8 : 7;
    +  const rawCreds = url.slice(startIndex, index);
    +  const colonIndex = rawCreds.indexOf(':');
    +  const username = rawCreds.slice(0, colonIndex);
    +  const password = rawCreds.slice(colonIndex + 1, rawCreds.length);
    --- End diff --
    
    Minor note but I think you could combine all of these variable instantiations and assignments in to a single const statement.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton issue #862: handle username and passwords correctly with bas...

Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the issue:

    https://github.com/apache/couchdb-fauxton/pull/862
  
    merged


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton issue #862: handle username and passwords correctly with bas...

Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on the issue:

    https://github.com/apache/couchdb-fauxton/pull/862
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request #862: handle username and passwords correctly w...

Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/862#discussion_r102475029
  
    --- Diff: app/addons/replication/api.js ---
    @@ -41,6 +42,38 @@ export const getAuthHeaders = (username, password) => {
       };
     };
     
    +export const getCredentialsFromUrl = (url) => {
    +  const index = url.lastIndexOf('@');
    +  if (index === -1) {
    +    return {
    +      username: '',
    +      password: ''
    +    };
    +  }
    +
    +  const startIndex = url.startsWith("https") ? 8 : 7;
    +  const rawCreds = url.slice(startIndex, index);
    +  const colonIndex = rawCreds.indexOf(':');
    +  const username = rawCreds.slice(0, colonIndex);
    +  const password = rawCreds.slice(colonIndex + 1, rawCreds.length);
    +
    +  return {
    +    username,
    +    password
    +  };
    +};
    +
    +export const removeCredentialsFromUrl = (url) => {
    +  const index = url.lastIndexOf('@');
    +  if (index === -1) {
    +    return url;
    +  }
    +
    +  const protocal = url.startsWith("https") ? "https://" : 'http://';
    --- End diff --
    
    protoc_o_l :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---