ACRA / acralyzer

Open source backend for ACRA reports.
GNU General Public License v3.0
489 stars 90 forks source link

New account/login ui #12

Closed halkeye closed 11 years ago

halkeye commented 11 years ago

New UI for users

Logged in screenshot: screenshot

Includes: html files in editorconfig (probably should do a * to add some defaults) Remove couchapp's login/profile stuff Angular-ui bootstrap init Focus/init-focus directive to trigger focusing on form field Change Password Option Moved enable desktop notifications to account menu

I tried to rebase to make the commit messages a bit cleaner, but rebasing is still very new to me. But couldn't get it to work, so it has a lot of random commit messages. I can redo the branch as a single commit if desired.

Its a pretty hefty change, I'd appreciate a review.

KevinGaudin commented 11 years ago

It looks like the change password does not work. I'm having a look.

halkeye commented 11 years ago

Does it give an error message or anything?

I'm pretty sure you can't change the password through the normal api of the main admin user. Thats why my screenshot was a random reporter_ user (I prefix my reporters with reporter))

I'll see if i can figure out how to detect admin users.

KevinGaudin commented 11 years ago

Yes, that's what I've just figured out, I was trying to change my admin user password. Futon on IrisCouch can update admin passwords with a PUT to /_config/admin/adminname containing the password as the body of the request. It looks like the _config API is specific to IrisCouch.

We can detect that a user is admin by looking for the _admin role.

halkeye commented 11 years ago

I installed couch 1.2.1 yesterday. Looks like the put thing works for that install as well.

Would it be better to not allow admins to change password, or do the PUT as it should work in at least some/most cases?

My vote is the PUT.

KevinGaudin commented 11 years ago

We might first send a GET to the same URL. It returns this kind of output if successful:

"-hashed-ebf7c6439526f65fc4b2900a69a4665d15112907,e43105b7ed145d27d200fd7f0f8b149d"
halkeye commented 11 years ago

hit the url just to see if the url is valid? Then disable change password if the url is not hittable?

That works for me.

I'll also update the login dialog so it fails with bad password/username/etc instead of silently failing.

KevinGaudin commented 11 years ago

Yes, and it should broadcast acralyzerEvents.LOGGED_IN and acralyzerEvents.LOGGED_OUT events to update the dashboard and start the background polling.

I don't know why, I haven't been able to send these events. It must have to do with the $apply block in updateState, I did not understand why it is required here...

halkeye commented 11 years ago

So the way I understand it, ng-click, events, and $http, all wrap callbacks in $scope.$apply. When variables change in $scope.$apply() then the UI can notice them and update.

Since the login is happening through callbacks with $.couch.session then the scope is not noticing any updates to variables. I wrapped it in the apply to fix that.

I will add the events though.

halkeye commented 11 years ago

so I added a new event, LOGIN_CHANGE. $on(function(event, $user) {});

if $user.username is null, we are logged out. I'm also firing the login/logout events

KevinGaudin commented 11 years ago

Tested OK. Merged. Thanks!