// Verify checks whether the provided token is valid and activates
// the account (if it wasn't already) and/or, if unverified email address
// exists, confirms it as the main email address.
// NOTE: provided Token must in its original / raw form - not combined with
// user's ID (as InitVerification method returns).
Verify checks whether the provided token is valid and activates
the account (if it wasn't already) and/or, if unverified email address
exists, confirms it as the main email address.
NOTE: provided Token must in its original / raw form - not combined with
user's ID (as InitVerification method returns).
// Verify checks whether the provided token is valid and activates // the account ( if it wasn ' t already ) and / or if unverified email address // exists confirms it as the main email address . // NOTE : provided Token must in its original / raw form - not combined with // user ' s ID ( as InitVerification method returns ) .
func (c *Core) Verify(t string) error {
	if err := c.Verification.Check(t); err != nil {
		return err
	}
	if !c.IsActivated() {
		c.ActivatedAt = zero.TimeFrom(timeutil.Now())
	}
	if c.UnverifiedEmail.String != "" {
		if c.UnverifiedEmail.String != c.Email {
			c.Email = c.UnverifiedEmail.String
		}
		c.UnverifiedEmail = zero.StringFrom("")
	}
	c.Verification.Clear()
	return nil
}
func ( c * Core ) Verify ( t string ) error { if err := c . Verification . Check ( t ) ; err != nil { return err } if ! c . IsActivated ( ) { c . ActivatedAt = zero . TimeFrom ( timeutil . Now ( ) ) } if c . UnverifiedEmail . String != " " { if c . UnverifiedEmail . String != c . Email { c . Email = c . UnverifiedEmail . String } c . UnverifiedEmail = zero . StringFrom ( " " ) } c . Verification . Clear ( ) return nil }
Verify checks whether the provided token is valid and activates
the account (if it wasn't already) and/or, if unverified email address
exists, confirms it as the main email address.
Verify checks whether the provided token is valid and activates the account ( if it wasn ' t already ) and / or if unverified email address exists confirms it as the main email address .
// New email verification and account activation is allowed at the // same time to allow the user to change their email when the account // is not activated. Account will be activated even during email // verification.