remove having to press enter in menus and OTP input

This commit is contained in:
Shihaam Abdul Rahman 2022-02-06 20:27:21 +05:00
parent b23c354a9a
commit 754c1e0751

12
bml-cli
View File

@ -527,7 +527,7 @@ echo "5 - Services"
echo "6 - Settings" echo "6 - Settings"
echo "" echo ""
printf 'Please Input: ' printf 'Please Input: '
read -r MENU read -n 1 -r MENU
if [ "$MENU" = "1" ] if [ "$MENU" = "1" ]
then then
@ -585,7 +585,7 @@ contacts_menu(){
echo "x - Go back" echo "x - Go back"
echo "" echo ""
printf 'Please Input: ' printf 'Please Input: '
read -r CONTACTS read -n 1 -r CONTACTS
if [ "$CONTACTS" = "1" ] || ["$CONTACTS" = "transfer" ] if [ "$CONTACTS" = "1" ] || ["$CONTACTS" = "transfer" ]
then then
@ -629,7 +629,7 @@ change_password(){
echo "1 - Mobile" echo "1 - Mobile"
echo "2 - Email" echo "2 - Email"
echo "" echo ""
read -p "Please input: " OTPCHANNEL read -n 1 -p "Please input: " OTPCHANNEL
if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ] if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ]
then then
@ -678,7 +678,7 @@ change_password(){
--data-raw channel=$OTPCHANNEL > /dev/null --data-raw channel=$OTPCHANNEL > /dev/null
echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset} echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset}
read -p 'Enter OTP: ' OTP read -n 6 -p 'Enter OTP: ' OTP
CHANGEPASSWORD=$(curl -s -b $COOKIE $BML_URL/user/changepassword \ CHANGEPASSWORD=$(curl -s -b $COOKIE $BML_URL/user/changepassword \
--data-raw currentPassword=$OLD_PASSWORD \ --data-raw currentPassword=$OLD_PASSWORD \
--data-raw newPassword=$NEW_PASSWORD \ --data-raw newPassword=$NEW_PASSWORD \
@ -726,7 +726,7 @@ settings(){
echo "3 - Change Password" echo "3 - Change Password"
echo "" echo ""
printf 'Please Input: ' printf 'Please Input: '
read -r SETTINGS read -n 1 -r SETTINGS
if [ "$SETTINGS" = "1" ] if [ "$SETTINGS" = "1" ]
then then
@ -769,7 +769,7 @@ init_login(){
display_banner && check_connection #& animate "Checking Internet Connection" display_banner && check_connection #& animate "Checking Internet Connection"
source $CONFIG source $CONFIG
source $CREDENTIALS source $CREDENTIALS
display_banner && os_detect #& animate "Detecting Operating System" display_banner && os_detect #& animate "Detecting Operating System"
display_banner && init_login display_banner && init_login
userinfo userinfo
display_banner && display_welcome && display_userinfo && main_menu display_banner && display_welcome && display_userinfo && main_menu