getting ready for adding password change

This commit is contained in:
Shihaam Abdul Rahman 2021-05-01 14:54:30 +05:00
parent 7e2193c130
commit 5f757b26c6
3 changed files with 43 additions and 0 deletions

40
changepassword.sh Normal file
View File

@ -0,0 +1,40 @@
read -s -p 'Enter Current Password: ' OLD_PASSWORD
echo ""
read -s -p 'Enter New Password: ' NEW_PASSWORD
echo ""
read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD
if [ "$NEW_PASSWORD" = "$REPEAT_NEWPASSWORD" ]
then
echo "Select OTP Method:"
echo "1 - Mobile"
echo "2 - Email"
echo ""
echo "Please input: "
read -r OTPCHANNEL
if [ "$OTPCHANNEL" = "1" ]
then
OTPCHANNEL=mobile
elif [ "$OTPCHANNEL" = "2" ]
then
OTPCHANNEL=email
else
echo "${red}Invalid Input${reset}"
fi
curl -s -b $COOKIE $BML_URL/user/changepassword' \
--data-raw currentPassword=$OLD_PASSWORD \
--data-raw newPassword=$NEW_PASSWORD \
--data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \
--data-raw channel=$OTPCHANNEL \
--compressed
curl -s -b $COOKIE $BML_URL/user/changepassword' \
--data-raw currentPassword=$OLD_PASSWORD \
--data-raw newPassword=$NEW_PASSWORD \
--data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \
--data-raw channel=$OTPCHANNEL
--data-raw otp=$OTP \
--compressed

View File

@ -3,6 +3,7 @@ then
source $CREDENTIALS
# echo "Attempting to login with saved credentials"
read -s -p 'Enter Pin: ' PIN
echo ""
BML_USERNAME=$(echo ${BML_USERNAME} |openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2)
BML_PASSWORD=$(echo ${BML_PASSWORD} |openssl enc -d -des3 -base64 -pass pass:${PIN} -pbkdf2)
if [ "$LOGIN" = "2" ]

View File

@ -51,4 +51,6 @@ else
:
fi
BML_USERNAME=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)
BML_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)
source welcome.sh