account

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangePassword

func ChangePassword(ctx *gin.Context, DB db.Database, userID string, resetForm *controllers.PasswordChange)

ChangePassword changes the user's password in the database This method requires the user to be logged in

func CompleteSignup added in v1.5.5

func CompleteSignup(ctx *gin.Context, DB db.Database, signupForm *controllers.CompleteSignupForm)

CompleteSignup performs the server-side signup operations that can only be done after the user is created.

It validates the signup token, checks if the email is already in use and sends the verification email

func Delete

func Delete(ctx *gin.Context, DB db.Database, userID string)

Delete deletes the given user (removing all of its traces (grades, reviews, etc))

This function wraps the document lookups and simply performs the necessary database operations

func GetMajors

func GetMajors(ctx *gin.Context, DB db.Database, userID string)

GetMajors retrieves the majors from a given user

func GetTranscriptYears

func GetTranscriptYears(ctx *gin.Context, DB db.Database, userID string)

GetTranscriptYears retrieves the last few years a user's has been in USP

func InsertUser

func InsertUser(DB db.Database, newUser *models.User, data *iddigital.Transcript) error

InsertUser takes the user object and their transcripts and performs all the required database insertions

func Login

func Login(ctx *gin.Context, DB db.Database, login *controllers.Login)

Login performs the user login by comparing the passwordHash and the stored hash

func Logout

func Logout(ctx *gin.Context)

Logout is a dummy method that simply calls the view method that will unset the access token cookie

func PreSignup added in v1.5.5

func PreSignup(ctx *gin.Context, DB db.Database, authForm *controllers.AuthForm)

PreSignup performs the server-side signup operations that can be done before the user is created.

It validates the access key, fetches the PDF, parses it and inserts the data into the database

func Profile

func Profile(ctx *gin.Context, DB db.Database, userID string)

Profile retrieves the user profile from the database

func RequestPasswordReset

func RequestPasswordReset(ctx *gin.Context, DB db.Database, form *controllers.EmailVerificationSubmission)

RequestPasswordReset send a password reset link to the requested email

func ResetPassword

func ResetPassword(ctx *gin.Context, DB db.Database, recovery *controllers.PasswordRecovery)

ResetPassword resets the user's password in the database

It differs from ChangePassword because it does not requires an access token

func SearchCurriculum

func SearchCurriculum(ctx *gin.Context, DB db.Database, userID string, controller *controllers.CurriculumQuery)

SearchCurriculum queries the user's given major subjects and returns which ones they have completed and if so, their record information (grade, status and frequency)

func SearchTranscript

func SearchTranscript(ctx *gin.Context, DB db.Database, userID string, controller *controllers.TranscriptQuery)

SearchTranscript takes a transcript query and retrieves its records with subject data attached to them

func Update

func Update(ctx *gin.Context, DB db.Database, userID string, updateForm *controllers.UpdateForm)

Update updates a user's profile with a new grade transcript

func UpdateUser

func UpdateUser(ctx context.Context, DB db.Database, data *iddigital.Transcript, userID string, updateTime time.Time) error

UpdateUser takes a new transcript and updates the user stored data

It does a diff operation on the already stored grade transcript, adding new final scores to the user's data and updating subject records

func VerifyAccount

func VerifyAccount(ctx *gin.Context, DB db.Database, verification *controllers.AccountVerification)

VerifyAccount sets the user's email as verified

func VerifyEmail

func VerifyEmail(ctx *gin.Context, DB db.Database, emailForm *controllers.EmailVerificationSubmission)

VerifyEmail sends a new verification email

Types

This section is empty.

Jump to

Keyboard shortcuts

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