MCPcopy Index your code
hub / github.com/gogs/gogs / MarkEmailActivated

Method MarkEmailActivated

internal/database/users.go:1127–1140  ·  view source on GitHub ↗

MarkEmailActivated marks the email address of the given user as activated, and new rands are generated for the user.

(ctx context.Context, userID int64, email string)

Source from the content-addressed store, hash-verified

1125// MarkEmailActivated marks the email address of the given user as activated,
1126// and new rands are generated for the user.
1127func (s *UsersStore) MarkEmailActivated(ctx context.Context, userID int64, email string) error {
1128 return s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
1129 err := s.db.WithContext(ctx).
1130 Model(&EmailAddress{}).
1131 Where("uid = ? AND email = ?", userID, email).
1132 Update("is_activated", true).
1133 Error
1134 if err != nil {
1135 return errors.Wrap(err, "mark email activated")
1136 }
1137
1138 return newUsersStore(tx).Update(ctx, userID, UpdateUserOptions{GenerateNewRands: true})
1139 })
1140}
1141
1142type ErrEmailNotVerified struct {
1143 args errutil.Args

Callers 4

usersGetEmailFunction · 0.80
usersMarkEmailActivatedFunction · 0.80
usersMarkEmailPrimaryFunction · 0.80
ActivateEmailFunction · 0.80

Calls 3

newUsersStoreFunction · 0.85
WhereMethod · 0.80
UpdateMethod · 0.65

Tested by 3

usersGetEmailFunction · 0.64
usersMarkEmailActivatedFunction · 0.64
usersMarkEmailPrimaryFunction · 0.64