Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OptionEmailMaxLength = 50
View Source
var OptionPasswordMaxLength = 50
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { CheckIfUserExists(email string) (bool, error) GetUserByEmail(email string) (*User, error) AddUser(email string, password string) (string, error) }
Database is an interface, which defines the interaction of the auth server with the database. You can use an existing database interface or add your own.
type MongoDatabase ¶
type MongoDatabase struct {
// contains filtered or unexported fields
}
MongoDatabase is an implementation for using Mongo as your database to store the users
func NewMongoDatabase ¶
func (*MongoDatabase) AddUser ¶
func (m *MongoDatabase) AddUser(email string, password string) (string, error)
AddUser adds a user to the database. It does not check for collisions.
func (*MongoDatabase) CheckIfUserExists ¶
func (m *MongoDatabase) CheckIfUserExists(email string) (bool, error)
CheckIfUserExists searches a user by the email address and returns true when one was found
func (*MongoDatabase) GetUserByEmail ¶
func (m *MongoDatabase) GetUserByEmail(email string) (*User, error)
GetUserByEmail fetches one user by the email address. It returns nil, when no user has been found.
type RequestData ¶
RequestData is a simple model to fetch the json request data
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (Server) HandleLoginForm ¶ added in v1.0.2
func (Server) HandleLoginJSON ¶ added in v1.0.2
func (Server) HandleRegisterForm ¶ added in v1.0.2
func (Server) HandleRegisterJSON ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.