Rewrite single file #22
							
								
								
									
										144
									
								
								bml-cli.sh
									
									
									
									
									
								
							
							
						
						
									
										144
									
								
								bml-cli.sh
									
									
									
									
									
								
							@@ -436,7 +436,10 @@ delete_contact(){
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
################################################################################################
 | 
					################################################################################################
 | 
				
			||||||
 | 
					activities(){
 | 
				
			||||||
 | 
					curl -s -b $COOKIE $BML_URL/activities?page=1 | jq 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
################################################################################################
 | 
					################################################################################################
 | 
				
			||||||
main_menu(){
 | 
					main_menu(){
 | 
				
			||||||
echo "Main Menu"
 | 
					echo "Main Menu"
 | 
				
			||||||
@@ -451,30 +454,27 @@ echo ""
 | 
				
			|||||||
printf 'Please Input: '
 | 
					printf 'Please Input: '
 | 
				
			||||||
read -r MENU
 | 
					read -r MENU
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$MENU" = "1" ]
 | 
						if [ "$MENU" = "1" ]
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
	display_banner
 | 
							display_banner
 | 
				
			||||||
	api_dashboard # & animate "Fetching account details"
 | 
							api_dashboard # & animate "Fetching account details"
 | 
				
			||||||
	display_banner
 | 
							display_banner
 | 
				
			||||||
	accounts
 | 
							accounts
 | 
				
			||||||
	accounts_menu
 | 
							accounts_menu
 | 
				
			||||||
elif [ "$MENU" = "2" ]
 | 
						elif [ "$MENU" = "2" ]
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
	display_banner && display_name && display_userinfo
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
	transfer_menu
 | 
							transfer_menu
 | 
				
			||||||
elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ]
 | 
						elif [ "$MENU" = "3" ] || [ "$MENU" = "contacts" ]
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
	display_banner && display_name && display_userinfo
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
	api_contacts #& animate "Fetching contacts"
 | 
							api_contacts #& animate "Fetching contacts"
 | 
				
			||||||
	#display_banner
 | 
							list_contacts
 | 
				
			||||||
	list_contacts
 | 
							contacts_menu
 | 
				
			||||||
	contacts_menu
 | 
						elif [ "$MENU" = "4" ]
 | 
				
			||||||
elif [ "$MENU" = "4" ]
 | 
					 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
	echo "WIP"
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
        sleep 2
 | 
							activities
 | 
				
			||||||
        source mainmenu.sh
 | 
					 | 
				
			||||||
	source activities.sh
 | 
					 | 
				
			||||||
	elif [ "$MENU" = "5" ]
 | 
						elif [ "$MENU" = "5" ]
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
        	echo "WIP"
 | 
					        	echo "WIP"
 | 
				
			||||||
@@ -549,26 +549,6 @@ transfer_menu(){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
###########################################################################################
 | 
					###########################################################################################
 | 
				
			||||||
change_password(){
 | 
					change_password(){
 | 
				
			||||||
	read -s -p 'Enter Current Password: ' OLD_PASSWORD
 | 
					 | 
				
			||||||
	echo ""
 | 
					 | 
				
			||||||
	echo ""
 | 
					 | 
				
			||||||
	while true; do
 | 
					 | 
				
			||||||
		read -s -p 'Enter New Password: ' NEW_PASSWORD
 | 
					 | 
				
			||||||
		echo ""
 | 
					 | 
				
			||||||
		read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD
 | 
					 | 
				
			||||||
		echo ""
 | 
					 | 
				
			||||||
		if [ "$NEW_PASSWORD" = "$REPEAT_NEWPASSWORD" ]
 | 
					 | 
				
			||||||
		then
 | 
					 | 
				
			||||||
			sleep 0.2
 | 
					 | 
				
			||||||
			echo ""
 | 
					 | 
				
			||||||
			break
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			echo "${red}Password do not match${reset}"
 | 
					 | 
				
			||||||
			echo "Try again"
 | 
					 | 
				
			||||||
			echo ""
 | 
					 | 
				
			||||||
		fi
 | 
					 | 
				
			||||||
		done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while true; do
 | 
						while true; do
 | 
				
			||||||
	echo "Select OTP Method:"
 | 
						echo "Select OTP Method:"
 | 
				
			||||||
	echo "1 - Mobile"
 | 
						echo "1 - Mobile"
 | 
				
			||||||
@@ -579,60 +559,81 @@ change_password(){
 | 
				
			|||||||
	if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ]
 | 
						if [ "$OTPCHANNEL" = "1" ] || [ "$OTPCHANNEL" = "mobile" ]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
		OTPCHANNEL=mobile
 | 
							OTPCHANNEL=mobile
 | 
				
			||||||
 | 
							ECHOOTPCHANNEL=$PHONE
 | 
				
			||||||
		break
 | 
							break
 | 
				
			||||||
	elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ]
 | 
						elif [ "$OTPCHANNEL" = "2" ] || [ "$OTPCHANNEL" = "email" ]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
		OTPCHANNEL=email
 | 
							OTPCHANNEL=email
 | 
				
			||||||
 | 
							ECHOOTPCHANNEL=$EMAIL
 | 
				
			||||||
		break
 | 
							break
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
		echo ${red}Invalid Input${reset}
 | 
							echo ${red}Invalid Input${reset}
 | 
				
			||||||
		echo ""
 | 
					 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	OLDPASSCHECHECK=$(curl -s -b $COOKIE $BML_URL/user/changepassword \
 | 
						read -s -p 'Enter Current Password: ' OLD_PASSWORD
 | 
				
			||||||
			--data-raw currentPassword=$OLD_PASSWORD \
 | 
					 | 
				
			||||||
			--data-raw newPassword=$NEW_PASSWORD \
 | 
					 | 
				
			||||||
			--data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \
 | 
					 | 
				
			||||||
			--data-raw channel=$OTPCHANNEL \
 | 
					 | 
				
			||||||
			--compressed \
 | 
					 | 
				
			||||||
			| jq -r .code)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if [ "$OLDPASSCHECHECK" = "17" ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		echo ${red}Login Required${reset}
 | 
					 | 
				
			||||||
		init_login
 | 
					 | 
				
			||||||
		display_banner && display_name && display_userinfo
 | 
					 | 
				
			||||||
		change_password
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if [ "$OTPCHANNEL" = "mobile" ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		ECHOOTPCHANNEL=$PHONE
 | 
					 | 
				
			||||||
	elif [ "$OTPCHANNEL" = "email" ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		ECHOOTPCHANNEL=$EMAIL
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo ""
 | 
						echo ""
 | 
				
			||||||
 | 
						while true; do
 | 
				
			||||||
 | 
							read -s -p 'Enter New Password: ' NEW_PASSWORD
 | 
				
			||||||
 | 
							echo ""
 | 
				
			||||||
 | 
							read -s -p 'Repeat New Password: ' REPEAT_NEWPASSWORD
 | 
				
			||||||
 | 
							echo ""
 | 
				
			||||||
 | 
							if [ "$NEW_PASSWORD" != "$REPEAT_NEWPASSWORD" ]
 | 
				
			||||||
 | 
							then
 | 
				
			||||||
 | 
								display_banner && display_name && display_userinfo
 | 
				
			||||||
 | 
								echo "${red}Password do not match${reset}"
 | 
				
			||||||
 | 
								echo "Try again"
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						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 > /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset}
 | 
						echo ${lightgreen}OTP sent to ${yellow}${ECHOOTPCHANNEL}${reset}
 | 
				
			||||||
	read -p 'Enter OTP: ' OTP
 | 
						read -p 'Enter OTP: ' OTP
 | 
				
			||||||
	echo ""
 | 
						CHANGEPASSWORD=$(curl -s -b $COOKIE $BML_URL/user/changepassword \
 | 
				
			||||||
	PASSCHANGED=$(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 \
 | 
				
			||||||
		--data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \
 | 
							--data-raw newPasswordConfirmation=$REPEAT_NEWPASSWORD \
 | 
				
			||||||
		--data-raw channel=$OTPCHANNEL \
 | 
							--data-raw channel=$OTPCHANNEL \
 | 
				
			||||||
		--data-raw otp=$OTP \
 | 
							--data-raw otp=$OTP \
 | 
				
			||||||
		--compressed \
 | 
					 | 
				
			||||||
		| jq -r .code)
 | 
							| jq -r .code)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "$PASSCHANGED" = "0" ]
 | 
						if [ "$CHANGEPASSWORD" = "0" ]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
		echo "${red}Failed to change password${reset}"
 | 
							echo Password changed succesfully ${reset}
 | 
				
			||||||
 | 
						elif [ "$CHANGEPASSWORD" = "8" ]
 | 
				
			||||||
 | 
						then
 | 
				
			||||||
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
 | 
							echo ${red}Old Password is incorrect${reset}
 | 
				
			||||||
 | 
							echo failed to change password
 | 
				
			||||||
 | 
							change_password
 | 
				
			||||||
 | 
						elif [ "$CHANGEPASSWORD" = "24" ]
 | 
				
			||||||
 | 
						then
 | 
				
			||||||
 | 
							display_banner && display_name && display_userinfo
 | 
				
			||||||
 | 
							echo ${red}Invalid OTP${reset}
 | 
				
			||||||
 | 
							echo failed to change password
 | 
				
			||||||
 | 
							change_password
 | 
				
			||||||
 | 
						elif [ "$CHANGEPASSWORD" = "17" ]
 | 
				
			||||||
 | 
						then
 | 
				
			||||||
 | 
							echo ${red}Login Required${reset}
 | 
				
			||||||
 | 
							init_login
 | 
				
			||||||
 | 
							display_banner
 | 
				
			||||||
 | 
							change_password
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		echo "${lightgreen}Password changed succesfully ${reset}"
 | 
							echo unknown error
 | 
				
			||||||
 | 
							main_menu
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
##############################################################################################
 | 
					##############################################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -650,7 +651,8 @@ settings(){
 | 
				
			|||||||
	if [ "$SETTINGS" = "1" ]
 | 
						if [ "$SETTINGS" = "1" ]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
		display_banner
 | 
							display_banner
 | 
				
			||||||
		logout
 | 
							wipe_credentials
 | 
				
			||||||
 | 
							cexit
 | 
				
			||||||
	elif [ "$SETTINGS" = "2" ]
 | 
						elif [ "$SETTINGS" = "2" ]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
		display_banner
 | 
							display_banner
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user