34 #define TORC_DEFAULT_USERNAME QStringLiteral("admin") 35 #define TORC_DEFAULT_CREDENTIALS QStringLiteral("f0f825afb7ee5ca70ba178463f360d4b") 47 m_canRestartTorc(
true),
63 m_userNameSetting->
Remove();
65 m_userCredentials->
Remove();
106 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"New credentials match old - not changing"));
111 static QRegExp gReg1(
"[\\w]{4,}");
112 if (!gReg1.exactMatch(Name))
114 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"Password unacceptable"));
120 static QRegExp gReg2(
"[0-9a-fA-F]{32}");
121 if (!gReg2.exactMatch(Credentials))
123 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"User credentials hash unacceptable"));
129 m_userNameSetting->
SetValue(QString(Name));
130 m_userCredentials->
SetValue(QString(Credentials.toLower()));
149 return m_canStopTorc;
161 return m_canRestartTorc;
177 Strings.insert(QStringLiteral(
"LoggedInUserTr"), QCoreApplication::translate(
"TorcUser",
"Logged in as %1"));
178 Strings.insert(QStringLiteral(
"RestartTorcTr"), QCoreApplication::translate(
"TorcUser",
"Restart Torc"));
179 Strings.insert(QStringLiteral(
"ConfirmRestartTorc"), QCoreApplication::translate(
"TorcUser",
"Are you sure you want to restart Torc?"));
180 Strings.insert(QStringLiteral(
"StopTorcTr"), QCoreApplication::translate(
"TorcUser",
"Stop Torc"));
181 Strings.insert(QStringLiteral(
"ConfirmStopTorc"), QCoreApplication::translate(
"TorcUser",
"Are you sure you want to stop Torc?"));
182 Strings.insert(QStringLiteral(
"ViewConfigTr"), QCoreApplication::translate(
"TorcUser",
"View configuration"));
183 Strings.insert(QStringLiteral(
"ViewConfigTitleTr"), QCoreApplication::translate(
"TorcUser",
"Current configuration"));
184 Strings.insert(QStringLiteral(
"ViewDOTTr"), QCoreApplication::translate(
"TorcUser",
"View DOT"));
185 Strings.insert(QStringLiteral(
"ViewDOTTitleTr"), QCoreApplication::translate(
"TorcUser",
"Stategraph Description"));
186 Strings.insert(QStringLiteral(
"ViewXSDTr"), QCoreApplication::translate(
"TorcUser",
"View XSD"));
187 Strings.insert(QStringLiteral(
"ViewXSDTitleTr"), QCoreApplication::translate(
"TorcUser",
"Configuration schema"));
188 Strings.insert(QStringLiteral(
"ViewAPITr"), QCoreApplication::translate(
"TorcUser",
"View API"));
189 Strings.insert(QStringLiteral(
"ViewAPITitleTr"), QCoreApplication::translate(
"TorcUser",
"API reference"));
190 Strings.insert(QStringLiteral(
"ViewLogTr"), QCoreApplication::translate(
"TorcUser",
"View Log"));
191 Strings.insert(QStringLiteral(
"RefreshTr"), QCoreApplication::translate(
"TorcUser",
"Refresh"));
192 Strings.insert(QStringLiteral(
"FollowLogTr"), QCoreApplication::translate(
"TorcUser",
"Follow Log"));
193 Strings.insert(QStringLiteral(
"FollowTr"), QCoreApplication::translate(
"TorcUser",
"Follow"));
194 Strings.insert(QStringLiteral(
"UnfollowTr"), QCoreApplication::translate(
"TorcUser",
"Unfollow"));
195 Strings.insert(QStringLiteral(
"Value"), QCoreApplication::translate(
"TorcUser",
"Value"));
196 Strings.insert(QStringLiteral(
"Valid"), QCoreApplication::translate(
"TorcUser",
"Valid"));
197 Strings.insert(QStringLiteral(
"CloseTr"), QCoreApplication::translate(
"TorcUser",
"Close"));
198 Strings.insert(QStringLiteral(
"SettingsTr"), QCoreApplication::translate(
"TorcUser",
"Settings"));
199 Strings.insert(QStringLiteral(
"ConfirmTr"), QCoreApplication::translate(
"TorcUser",
"Confirm"));
200 Strings.insert(QStringLiteral(
"CancelTr"), QCoreApplication::translate(
"TorcUser",
"Cancel"));
201 Strings.insert(QStringLiteral(
"ChangeCredsTr"), QCoreApplication::translate(
"TorcUser",
"Change username and password"));
202 Strings.insert(QStringLiteral(
"UsernameTr"), QCoreApplication::translate(
"TorcUser",
"Username"));
203 Strings.insert(QStringLiteral(
"PasswordTr"), QCoreApplication::translate(
"TorcUser",
"Password"));
204 Strings.insert(QStringLiteral(
"Username2Tr"), QCoreApplication::translate(
"TorcUser",
"Confirm username"));
205 Strings.insert(QStringLiteral(
"Password2Tr"), QCoreApplication::translate(
"TorcUser",
"Confirm password"));
206 Strings.insert(QStringLiteral(
"CredentialsHelpTr"), QCoreApplication::translate(
"TorcUser",
"Usernames and passwords are case sensitive, must be at least 4 characters long and can only contain letters, numbers and \'_\' (underscore)."));
207 Strings.insert(QStringLiteral(
"ServicesTr"), QCoreApplication::translate(
"TorcUser",
"Services"));
208 Strings.insert(QStringLiteral(
"ReturnformatsTr"), QCoreApplication::translate(
"TorcUser",
"Return formats"));
209 Strings.insert(QStringLiteral(
"WebSocketsTr"), QCoreApplication::translate(
"TorcUser",
"WebSockets"));
210 Strings.insert(QStringLiteral(
"AvailableservicesTr"),QCoreApplication::translate(
"TorcUser",
"Available services"));
211 Strings.insert(QStringLiteral(
"IDTr"), QCoreApplication::translate(
"TorcUser",
"ID"));
212 Strings.insert(QStringLiteral(
"NameTr"), QCoreApplication::translate(
"TorcUser",
"Name"));
213 Strings.insert(QStringLiteral(
"PathTr"), QCoreApplication::translate(
"TorcUser",
"Path"));
214 Strings.insert(QStringLiteral(
"DetailsTr"), QCoreApplication::translate(
"TorcUser",
"Details"));
215 Strings.insert(QStringLiteral(
"HTTPreturnformatsTr"),QCoreApplication::translate(
"TorcUser",
"Supported HTTP return formats"));
216 Strings.insert(QStringLiteral(
"ContenttypeTr"), QCoreApplication::translate(
"TorcUser",
"Content type"));
217 Strings.insert(QStringLiteral(
"WSsubprotocolsTr"), QCoreApplication::translate(
"TorcUser",
"Supported WebSocket subprotocols"));
218 Strings.insert(QStringLiteral(
"DescriptionTr"), QCoreApplication::translate(
"TorcUser",
"Description"));
219 Strings.insert(QStringLiteral(
"ParametersTr"), QCoreApplication::translate(
"TorcUser",
"Parameters"));
220 Strings.insert(QStringLiteral(
"JSreturntypeTr"), QCoreApplication::translate(
"TorcUser",
"Javascript return type"));
221 Strings.insert(QStringLiteral(
"MethodlistTr"), QCoreApplication::translate(
"TorcUser",
"Method list"));
222 Strings.insert(QStringLiteral(
"GetterTr"), QCoreApplication::translate(
"TorcUser",
"Getter"));
223 Strings.insert(QStringLiteral(
"NotificationTr"), QCoreApplication::translate(
"TorcUser",
"Notification"));
224 Strings.insert(QStringLiteral(
"UpdateTr"), QCoreApplication::translate(
"TorcUser",
"Update"));
#define TORC_DEFAULT_CREDENTIALS
A wrapper around a database setting.
bool GetCanRestartTorc(void)
A factory class for automatically running objects outside of the main loop.
QString GetUserName(void)
virtual bool DownRef(void)
#define TORC_USER_SERVICE
static void NotifyEvent(int Event)
#define TORC_DEFAULT_USERNAME
static QMutex gUserCredentialsLock
#define TORC_ADMIN_LOW_PRIORITY
static QByteArray GetCredentials(void)
bool GetCanStopTorc(void)
void HandleSubscriberDeleted(QObject *Subscriber)
bool SetUserCredentials(const QString &Name, const QString &Credentials)
QReadWriteLock m_httpServiceLock
static QString GetName(void)
TorcUserObject TorcUserObject
bool SetValue(const QVariant &Value)
static QByteArray gUserCredentials
#define LOG(_MASK_, _LEVEL_, _STRING_)
void GetStrings(QVariantMap &Strings)
void UpdateUserName(QString &Name)
A factory class to register translatable strings for use with external interfaces/applications.
void UpdateCredentials(QString &Credentials)
void ValueChanged(int Value)
void SubscriberDeleted(QObject *Subscriber)