MCPcopy Create free account
hub / github.com/gogs/gogs / verifyActiveEmailCode

Function verifyActiveEmailCode

internal/route/user/auth.go:440–456  ·  view source on GitHub ↗

verify active code when active account

(code, email string)

Source from the content-addressed store, hash-verified

438
439// verify active code when active account
440func verifyActiveEmailCode(code, email string) *database.EmailAddress {
441 minutes := conf.Auth.ActivateCodeLives
442
443 if user := parseUserFromCode(code); user != nil {
444 // time limit code
445 prefix := code[:tool.TimeLimitCodeLength]
446 data := com.ToStr(user.ID) + email + user.LowerName + user.Password + user.Rands
447
448 if tool.VerifyTimeLimitCode(data, minutes, prefix) {
449 emailAddress, err := database.Handle.Users().GetEmail(gocontext.TODO(), user.ID, email, false)
450 if err == nil {
451 return emailAddress
452 }
453 }
454 }
455 return nil
456}
457
458func Activate(c *context.Context) {
459 code := c.Query("code")

Callers 1

ActivateEmailFunction · 0.85

Calls 4

VerifyTimeLimitCodeFunction · 0.92
parseUserFromCodeFunction · 0.85
GetEmailMethod · 0.80
UsersMethod · 0.80

Tested by

no test coverage detected