cutelyst 4.3.0
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#include <Cutelyst/cutelyst_global.h>
11
12namespace Cutelyst {
13
14class ValidatorPwQualityPrivate;
15
59class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorPwQuality : public ValidatorRule
60{
61public:
65 static constexpr int defaultThreshold{30};
66
80 explicit ValidatorPwQuality(const QString &field,
81 int threshold = ValidatorPwQuality::defaultThreshold,
82 const QVariant &options = QVariant(),
83 const QString &userName = QString(),
84 const QString &oldPassword = QString(),
85 const ValidatorMessages &messages = ValidatorMessages());
86
91
104 static int validate(const QString &value,
105 const QVariant &options = QVariant(),
106 const QString &oldPassword = QString(),
107 const QString &user = QString());
108
120 static QString errorString(Context *c,
121 int returnValue,
122 const QString &label = QString(),
123 int threshold = 0);
124
125protected:
132 ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
133
137 QString genericValidationError(Context *c, const QVariant &errorData) const override;
138
139private:
140 Q_DECLARE_PRIVATE(ValidatorPwQuality) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
141 Q_DISABLE_COPY(ValidatorPwQuality)
142};
143
144} // namespace Cutelyst
145
146#endif // CUTELYSTVALIDATORPWQUALITY_H
The Cutelyst Context.
Definition context.h:42
Validates an input field with libpwquality to check password quality.
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.