-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth
86 lines (66 loc) · 1.24 KB
/
auth
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
register(){
read -p "Enter official mail ID :: " mail
echo
blank $mail register
echo $mail > .temp
md5s=$(md5sum ".temp")
md5=$(echo $md5s | cut -c1-6)
echo
echo "please wait.."
$HOME/project/gmail.bash $mail $md5 > .temp &
echo
echo "[ PASSWORD IS SENT TO YOUR MAIL ]"
echo "[ OPEN YOUR MAIL TO GET PASSWORD ]"
echo
menu
}
login(){
read -p "Enter official mail ID :: " mail
echo
blank $mail login
read -p "Enter password :: " pass
blank $pass login
echo $mail > .temp
md5s=$(md5sum ".temp")
md5=$(echo $md5s | cut -c1-6)
if [[ "$pass" == "$md5" ]]; then
echo
echo "[ authenticating.. ]"
$HOME/project/gmail.bash $mail "YOU ARE LOGGED IN TO STUDENT COMPLAINT PORTAL SUCCESSFULLY.." > .temp &
echo $mail > .auth
else
echo
echo "[ please check your password and try again.. ]"
$HOME/project/gmail.bash $mail "SOMEONE TRIED TO LOGIN IN YOUR ACCOUNT.." > .temp &
menu
fi
}
blank() {
if [ -z $1 ];
then
$2
exit
fi
}
menu(){
if [ ! -f ".auth" ]; then
echo
echo "1) LOGIN"
echo
echo "2) REGISTER"
echo
#echo "3) QUIT"
echo
read -p "Choice :: " choice
echo
blank $choice
case $choice in
1) login ;;
2) register ;;
3) ;;
*) menu ;;
esac
fi
}
menu