promt to login if logged in from another app while using bml-cli - dashboard

This commit is contained in:
Shihaam Abdul Rahman 2021-05-20 00:44:47 +05:00
parent 1565c14aa8
commit 0799b0764f

View File

@ -200,7 +200,13 @@ login(){
savepass savepass
elif [ "$LOGIN" = "20" ] elif [ "$LOGIN" = "20" ]
then then
banner
account_locked account_locked
sleep 1.5
banner
echo "${red}Account Locked!${reset}"
echo "${lightred}Please reset password and login again.${reset}"
enter_credentials
elif [ "$LOGIN" = "2" ] elif [ "$LOGIN" = "2" ]
then then
banner banner
@ -221,9 +227,6 @@ login(){
################################################################################################ ################################################################################################
account_locked(){ account_locked(){
echo "${red}Account Locked!${reset}"
echo "${lightred}Please reset password and login again.${reset}"
echo ""
if [ "$OS" = "macos" ] if [ "$OS" = "macos" ]
then then
open $BML_RESETPASS open $BML_RESETPASS
@ -236,7 +239,6 @@ account_locked(){
else else
xdg-open $BML_RESETPASS xdg-open $BML_RESETPASS
fi fi
enter_credentials
} }
################################################################################################ ################################################################################################
@ -284,14 +286,14 @@ userinfo(){
################################################################################################ ################################################################################################
accounts(){ accounts(){
curl -s -b $COOKIE $BML_URL/dashboard \ echo $API_DASHBOARD \
| jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)' | jq -r '.payload | .dashboard |.[] | (.alias, .account, .currency, .availableBalance)'
} }
################################################################################################ ################################################################################################
api_dashboard(){ api_dashboard(){
API_DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard) API_DASHBOARD=$(curl -s -b $COOKIE $BML_URL/dashboard)
SUCCESS=$(echo $API_CONATACTS | jq -r .success) SUCCESS=$(echo $API_DASHBOARD | jq -r .success)
if [ "$SUCCESS" != "true" if [ "$SUCCESS" != "true" ]
then then
echo "Login Required" echo "Login Required"
init_login init_login