Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

first attempt at carbon-pouchdb-auth #1

Closed
wants to merge 10 commits into from
Closed

Conversation

e111077
Copy link
Contributor

@e111077 e111077 commented May 9, 2016

General usage:

<carbon-pouchdb-auth db-name="http://remote.address.here:1234/"></carbon-pouchdb-auth>
<!-- ... -->
<script>
auth.login('asdf', 'asdf').then(...).catch(...);

auth.changePassword('new password here').then(...).catch(...);
// for admins
auth.changePassword('new password here', 'otherUser').then(...).catch(...);

auth.updateMetadata({first: 'Ben', last: 'Bitdiddle', email:'bbitdiddle@mit.edu'})
    .then(...).catch(...);
// for admins
auth.updateMetadata({first: 'Ben', last: 'Bitdiddle', email:'bbitdiddle@mit.edu'},
    'bbitsUsername').then(...).catch(...);
// ...
auth.logout().then(...).catch(...);
// success response will be {ok:true, online:{true | false}}
</script>

.session and .isLoggedIn are both read-only. Tests have not been added in yet.

If offline, logout will not delete session cookie, but this element's session object will reflect a logged-out session. (UI logout only)

@@ -21,7 +21,8 @@
"pouchdb": "^5.3.1",
"pouchdb-find": "^0.9.0",
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
"carbon-storage": "git@github.com:polymerelements/carbon-storage.git"
"carbon-storage": "git@github.com:polymerelements/carbon-storage.git",
"pouchdb-authentication": "^0.5.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cdata
Copy link
Contributor

cdata commented May 14, 2016

This is looking great. I kind of want us to add a test, but I'm not sure there is a good way to do that without coming up with a creative way to stub a CouchDB server. So... let's merge it and move on with our lives :)

Elliott Marquez added 7 commits May 16, 2016 13:01
@e111077 e111077 force-pushed the carbon-pouchdb-auth branch from 357500c to 4075167 Compare May 16, 2016 20:58
@e111077
Copy link
Contributor Author

e111077 commented May 16, 2016

@cdata changed from carbon -> app, added documentation, and added an isSetup flag. Here is the relevant, readable diff.

`app-pouchdb-auth-response` event will also be fired. If the response is an
error response, `app-pouchdb-auth-error` event will also be fired.

_Note: The `dbName` MUST point to the remote database._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be many remote databases; the -> a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


<script>
Polymer({
is: 'my-app-name',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At what point in the example implementation should the app attempt to log the user in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can put it in the authReadyChanged function, but I don't see any practical reason to statically log into a user.

@e111077 e111077 force-pushed the carbon-pouchdb-auth branch from d906330 to 02fe35e Compare May 17, 2016 00:17
@e111077
Copy link
Contributor Author

e111077 commented May 17, 2016

@cdata That little deadlock fix seems to have RESOLVED everything. Get it? Resolve? Promises?

Fine then, don't laugh.

@e111077
Copy link
Contributor Author

e111077 commented May 17, 2016

@rictic since Chris is out, do you mind taking a look at this PR?

@e111077 e111077 closed this Mar 17, 2017
@e111077 e111077 deleted the carbon-pouchdb-auth branch May 12, 2017 22:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants