func (s *IdentityService) UpsertSignupToken(token string, tokenData services.SignupToken, ttl time.Duration) error {
	if ttl < time.Second || ttl > defaults.MaxSignupTokenTTL {
		ttl = defaults.MaxSignupTokenTTL
	}
	tokenData.Expires = time.Now().UTC().Add(ttl)
	out, err := json.Marshal(tokenData)
	if err != nil {
		return trace.Wrap(err)
	}

	err = s.backend.UpsertVal(userTokensPath, token, out, ttl)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil

}
// UpsertSignupToken upserts signup token - one time token that lets user to create a user account
UpsertSignupToken upserts signup token - one time token that lets user to create a user account
// UpsertSignupToken upserts signup token - one time token that lets user to create a user account
func (s *IdentityService) UpsertSignupToken(token string, tokenData services.SignupToken, ttl time.Duration) error {
	if ttl < time.Second || ttl > defaults.MaxSignupTokenTTL {
		ttl = defaults.MaxSignupTokenTTL
	}
	tokenData.Expires = time.Now().UTC().Add(ttl)
	out, err := json.Marshal(tokenData)
	if err != nil {
		return trace.Wrap(err)
	}
	err = s.backend.UpsertVal(userTokensPath, token, out, ttl)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
func ( s * IdentityService ) UpsertSignupToken ( token string , tokenData services . SignupToken , ttl time . Duration ) error { if ttl < time . Second || ttl > defaults . MaxSignupTokenTTL { ttl = defaults . MaxSignupTokenTTL } tokenData . Expires = time . Now ( ) . UTC ( ) . Add ( ttl ) out , err := json . Marshal ( tokenData ) if err != nil { return trace . Wrap ( err ) } err = s . backend . UpsertVal ( userTokensPath , token , out , ttl ) if err != nil { return trace . Wrap ( err ) } return nil }
UpsertSignupToken upserts signup token - one time token that lets user to create a user account
UpsertSignupToken upserts signup token - one time token that lets user to create a user account