cutelyst  4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorpwquality.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2018-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORPWQUALITY_H
6 #define CUTELYSTVALIDATORPWQUALITY_H
7 
8 #include "validatorrule.h"
9 
10 namespace Cutelyst {
11 
12 class ValidatorPwQualityPrivate;
13 
57 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorPwQuality : public ValidatorRule
58 {
59 public:
63  static constexpr int defaultThreshold{30};
64 
78  explicit ValidatorPwQuality(const QString &field,
80  const QVariant &options = QVariant(),
81  const QString &userName = QString(),
82  const QString &oldPassword = QString(),
83  const ValidatorMessages &messages = ValidatorMessages());
84 
88  ~ValidatorPwQuality() override;
89 
102  static int validate(const QString &value,
103  const QVariant &options = QVariant(),
104  const QString &oldPassword = QString(),
105  const QString &user = QString());
106 
118  static QString errorString(Context *c,
119  int returnValue,
120  const QString &label = QString(),
121  int threshold = 0);
122 
123 protected:
130  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
131 
135  QString genericValidationError(Context *c, const QVariant &errorData) const override;
136 
137 private:
138  Q_DECLARE_PRIVATE(ValidatorPwQuality) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
139  Q_DISABLE_COPY(ValidatorPwQuality)
140 };
141 
142 } // namespace Cutelyst
143 
144 #endif // CUTELYSTVALIDATORPWQUALITY_H
The Cutelyst Context.
Definition: context.h:42
Validates an input field with libpwquality to check password quality.
static constexpr int defaultThreshold
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49