-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.cpp
More file actions
61 lines (59 loc) · 1.42 KB
/
Copy pathcheck.cpp
File metadata and controls
61 lines (59 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "check.h"
bool check_username(QString _username,QWidget* _this)
{
if(_username.size()>4)
{
if(findUser(_username)==-1 )
{
return 1;
}
else
{
QMessageBox::warning(_this,"Warning","This username already exists in list!");
return 0;
}
}
else
{
QMessageBox::warning(_this,"Warning","This username is to short!");
return 0;
}
}
bool password_strength(QString _password,int* _powerPass)
{
int i;
int s = 0;
for (i = 0; i<_password.size(); i++)
{
if ('A' <= _password[i] && _password[i] <= 'Z')
{
s = s + 4;
}
else if ('a' <= _password[i] &&_password[i] <= 'z')
{
s = s + 2;
}
else if ('0' <= _password[i] && _password[i] <= '9')
{
s = s + 3;
}
else if (_password[i] == ' ')
{
s = s + 1;
}
else
{
s = s + 8;
}
if(_password.count(_password[i])>3)
{
return 1;
}
}
*_powerPass=s;
if (s > 100 || s < 33)
{
return 1;
}
return 0;
}