feat(identity): confirm registration email atomically
This commit is contained in:
1 parent
8e7ce8d71c
commit
fade4e76e4
75 files changed
+4188
-403
No files matched your search
@@ -315,6 +315,98 @@ func decodeCancelMyInvitationParams(args [1]string, argsEscaped bool, r *http.Re
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ConfirmEmailParams is parameters of ConfirmEmail operation.
|
||||
type ConfirmEmailParams struct {
|
||||
// The exact configured public application origin. This optional parameter is read by the server as
|
||||
// empty when absent, so the operation answers csrf_check_failed rather than treating a missing Origin
|
||||
// as an allowed request.
|
||||
Origin OptString `json:",omitempty,omitzero"`
|
||||
}
|
||||
|
||||
func unpackConfirmEmailParams(packed middleware.Parameters) (params ConfirmEmailParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "Origin",
|
||||
In: "header",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Origin = v.(OptString)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeConfirmEmailParams(args [0]string, argsEscaped bool, r *http.Request) (params ConfirmEmailParams, _ error) {
|
||||
h := uri.NewHeaderDecoder(r.Header)
|
||||
// Decode header: Origin.
|
||||
if err := func() error {
|
||||
cfg := uri.HeaderParameterDecodingConfig{
|
||||
Name: "Origin",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.HasParam(cfg); err == nil {
|
||||
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotOriginVal string
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotOriginVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.Origin.SetTo(paramsDotOriginVal)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := params.Origin.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 2048,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: nil,
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(value)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "Origin",
|
||||
In: "header",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateMyAssessmentAttemptParams is parameters of CreateMyAssessmentAttempt operation.
|
||||
type CreateMyAssessmentAttemptParams struct {
|
||||
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
|
||||
|
||||
Reference in new issue
Block a user