Documentation ¶
Overview ¶
Package auth implements user registration and authentication for chat project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateHandler ¶
func AuthenticateHandler(w http.ResponseWriter, r *http.Request)
AuthenticateHandler gets user, password, redirect parameters from request and logs in the user. Response has Token session cookie. If redirect=1 redirects to /index.html.
func CreateHandler ¶
func CreateHandler(w http.ResponseWriter, r *http.Request)
CreateHandler checks if user, email and rt parameters match registration file and creates permanent user profile. Redirects to AuthenticateHandler with user and password and redirect=1 parameters
func RegisterHandler ¶
func RegisterHandler(w http.ResponseWriter, r *http.Request)
RegisterHandler gets user and email parameters from request. Creates provisional user registration file and sends email to the administrator. Email has the link which should call the CreateHandler. Administrator should accept the registration by forwarding the email to the user. User should follow the link which calls CreateHandler which completes user registration.
Types ¶
type UserAuth ¶
UserAuth is a authentication record
func GetAuthUser ¶
GetAuthUser finds authenticated user in the list by token. TODO: Eventually should accept user id from cookie to minimize user lookup time.