github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/userverificationresend.go (about)

     1  // Copyright (c) 2017-2019 The Decred developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	v1 "github.com/decred/politeia/politeiawww/api/www/v1"
     9  	"github.com/decred/politeia/politeiawww/cmd/shared"
    10  )
    11  
    12  // userVerificationResendCmd re-sends the user verification email for an
    13  // unverified user.
    14  type userVerificationResendCmd struct {
    15  	Args struct {
    16  		Email     string `positional-arg-name:"email"`     // User email
    17  		PublicKey string `positional-arg-name:"publickey"` // User public key
    18  	} `positional-args:"true" required:"true"`
    19  }
    20  
    21  // Execute executes the userVerificationResendCmd command.
    22  //
    23  // This function satisfies the go-flags Commander interface.
    24  func (cmd *userVerificationResendCmd) Execute(args []string) error {
    25  	rv := v1.ResendVerification{
    26  		Email:     cmd.Args.Email,
    27  		PublicKey: cmd.Args.PublicKey,
    28  	}
    29  
    30  	err := shared.PrintJSON(rv)
    31  	if err != nil {
    32  		return err
    33  	}
    34  
    35  	rvr, err := client.ResendVerification(rv)
    36  	if err != nil {
    37  		return err
    38  	}
    39  
    40  	return shared.PrintJSON(rvr)
    41  }
    42  
    43  // userVerificationResendHelpMsg is the output of the help command when
    44  // 'userverificationresend' is specified.
    45  var userVerificationResendHelpMsg = `userverificationresend 
    46  
    47  Resend the user verification email.  The user is only allowed to resend the
    48  verification email one time before they must wait for the verification token to
    49  expire.  The 'publickey' argument is typically the same public key that was
    50  used during user creation, but it does not have to be.  Sending in a different
    51  public key is allowed and will update the user's active identity.
    52  
    53  The response field 'verificationtoken' will only contain a value if email has
    54  been disabled on politeiawww.
    55  
    56  Arguments:
    57  1. email        (string, required)   User email address
    58  2. publickey    (string, required)   User public key`