user

package
v0.0.0-...-3ba4ce3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRefreshToken

func CheckRefreshToken(jwtToken string) (*jwt.StandardClaims, error)

CheckRefreshToken checks if a refresh token is valid. In case of invalidity a theft is assumed and the users sessions are nuked

func GenerateAccessToken

func GenerateAccessToken(refreshToken string) (string, error)

GenerateAccessToken issues a new access token based on a refresh token

func GenerateRefreshToken

func GenerateRefreshToken(userID string) (*string, error)

GenerateRefreshToken generates a new refresh-token and saves it in the database

func Login

func Login(usernameOrEmail string, password string) (*string, *routes.APIError)

Login a user

func Register

func Register(params RegisterData) *routes.APIError

Register a new user account

func RegisterNamespace

func RegisterNamespace()

RegisterNamespace registers all functions for users

func SendRegistrationEmail

func SendRegistrationEmail(user db.User) *error

SendRegistrationEmail sends a registration email, with confirmation link

Types

type ForgotPassword

type ForgotPassword struct {
	Email string `json:"email"`
}

ForgotPassword is the required information required to request a reset password email

type LoginData

type LoginData struct {
	UsernameOrEmail string `json:"id" binding:"required"`
	Password        string `json:"password" binding:"required"`
	RememberMe      bool   `json:"rememberMe" binding:"required"`
}

LoginData is the required information for logging in

type RegisterData

type RegisterData struct {
	Username  string `json:"username" validate:"required,min=3,max=16"`
	Password  string `json:"password" validate:"required,min=3"`
	Email     string `json:"email" validate:"required,email"`
	Language  string `json:"language" validate:"required"`
	FirstName string `json:"firstName" validate:"required"`
	LastName  string `json:"lastName" validate:"required"`
}

RegisterData is the required information for registering

type ResetPasswordData

type ResetPasswordData struct {
	Token       string `json:"token"`
	NewPassword string `json:"newPassword"`
}

ResetPasswordData is the required information to reset the password

Jump to

Keyboard shortcuts

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