handler

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	web.Handler
	// contains filtered or unexported fields
}

User is the handler for handling requests made for managing registration, authentication and account management.

func New

func New(h web.Handler, registry *provider.Registry) User

func (User) Cleanup

func (h User) Cleanup(w http.ResponseWriter, r *http.Request)

Cleanup will either disable or enable artifact cleaning for the current user.

func (User) Destroy

func (h User) Destroy(w http.ResponseWriter, r *http.Request)

Destroy will mark the user's account as deleted by setting the deleted_at column in the database to the current time.

func (User) Email

func (h User) Email(w http.ResponseWriter, r *http.Request)

Email will update the user's email to the one given in the request.

func (User) GetProviders

func (h User) GetProviders(u *user.User) ([]*provider.Provider, error)

func (User) Home

func (h User) Home(w http.ResponseWriter, r *http.Request)

Home is the handler for the "/" route. This will either redirect to the login page, or the builds overview depending on whether or not the user is logged in.

func (User) Login

func (h User) Login(w http.ResponseWriter, r *http.Request)

Login will serve the HTML response for logging in on a GET request. This will either allow for direct authentication against the server itself or will allow for logging in via a third party provider. On a POST request it will attempt to authenticate the user. On successful authentication the user is set in the session, and redirected to the main dashboard.

func (User) Logout

func (h User) Logout(w http.ResponseWriter, r *http.Request)

Logout will log the user out of the current session.

func (User) NewPassword

func (h User) NewPassword(w http.ResponseWriter, r *http.Request)

NewPassword serves the HTML response for setting a new password on a GET request. On a POST request this will attempt to set the new password the user specified for their account, if the token given to them via email is valid.

func (User) Password

func (h User) Password(w http.ResponseWriter, r *http.Request)

Password will update the user's password to the one given in the request.

func (User) PasswordReset

func (h User) PasswordReset(w http.ResponseWriter, r *http.Request)

PasswordReset will serve the HTML response for requesting a password reset token as part of the forgotten password flow. On a POST request this will generate a new account token that is used for authenticating the user resetting the password when they cannot otherwise provide meaningful authentication. The token that is generated expires after a minute.

func (User) Register

func (h User) Register(w http.ResponseWriter, r *http.Request)

Register will serve the HTML response for registering an account on a GET request. On a POST request it will validate the user's account being created and attempt to create a new user. On successful registration an email will be sent for the account to be verified, and the user will be redirect to the login page.

func (User) Settings

func (h User) Settings(w http.ResponseWriter, r *http.Request)

Settings will serve the HTML response showing the settings page for managing a user's account.

func (User) Verify

func (h User) Verify(w http.ResponseWriter, r *http.Request)

Verify will either send a verification email to the user, or verify the user's account. If the tok query parameter is in the current request then an attempt will be made to verify the user's account. If the tok query parameter is not in the current request then the verification email is sent for account verification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL