dingoblog / dingo

Blog engine written in Go
MIT License
284 stars 37 forks source link

signup page forward to not found page after signup and logout #46

Open nak3 opened 8 years ago

nak3 commented 8 years ago

Please see reproduce steps:

step-1. current version
$ git log --oneline -p -1
601a49d Merge pull request #22 from dinever/admin_ui
step-2. Start dingo
go run main.go
step-3. Access and signup Dingo

http://localhost:8000/signup/

step-4. Logout
step-5. Go to sign up page

It returns not found page. (Even from http://localhost:8000/login to push SIGN UP, it shows not found page.)

dinever commented 8 years ago

Thanks for the feedback! @nak3

This is actually an intended behavior. The signup page won't work if there is already a registered user.

The related code can be found here: app/handler/auth.go#L34

The reason behind this is that we don't want other people to sign up the site and have control of the content.

Maybe we can add a feature in the future to allow the admin user to send invitation link to other people for them to sign up and add content to the site, and add a role-based permission system(e.g. a user can be admin or writer).

nak3 commented 8 years ago

Hi @dinever Thank you for your explanation. I understand it. So, we should have one feature and one fix.

In terms of feature, as you explained, it will be nice to have the feature to send an invitation by admin user. Otherwise I feel we can have admin page which have a button to Add User with role managment.

Then, as for a fix, Login page should not show the sign up button if there is already a registered user.

nak3 commented 8 years ago

In any case, please feel free to close this report, if you would like. Or if you would like to track the feature/fix, I'm alright to leave this open.

TimothyYe commented 8 years ago

I also reproduced this issue and saw there was an 500 internal server error:

Sorry, the requested URL caused an error:
template: 404.html:44: function "DateInt64" not defined

I agree with @nak3 , if there is already a registered user, we'd better hide that "sign up" button.