mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-20 21:33:16 -07:00
Now detects incorrect username/password
This commit is contained in:
parent
1fec4755b6
commit
0e7f98756f
1 changed files with 8 additions and 5 deletions
|
@ -136,6 +136,7 @@ keypair() {
|
||||||
function cleanup {
|
function cleanup {
|
||||||
rm /tmp/kaka 2>/dev/null >/dev/null
|
rm /tmp/kaka 2>/dev/null >/dev/null
|
||||||
rm /tmp/postdata 2>/dev/null >/dev/null
|
rm /tmp/postdata 2>/dev/null >/dev/null
|
||||||
|
rm /tmp/raw 2>/dev/null >/dev/null
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
@ -171,15 +172,17 @@ if [ "${KEEP}" != "yes" -o ! -f /tmp/kaka ] && [ "${PUBLIC}" == "no" ]; then
|
||||||
echo -ne >>/tmp/postdata "&$(keypair "commit" "Sign in" )"
|
echo -ne >>/tmp/postdata "&$(keypair "commit" "Sign in" )"
|
||||||
|
|
||||||
# Authenticate
|
# Authenticate
|
||||||
wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_LOGIN}" --post-file=/tmp/postdata -O /dev/null 2>/dev/null
|
wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_LOGIN}" --post-file=/tmp/postdata -O /tmp/raw 2>/dev/null
|
||||||
RET=$?
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error: Unable to authenticate"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Delete authentication data ... Bad idea to let that stick around
|
# Delete authentication data ... Bad idea to let that stick around
|
||||||
rm /tmp/postdata
|
rm /tmp/postdata
|
||||||
|
|
||||||
# Provide some details to the end user
|
# Provide some details to the end user
|
||||||
if [ ${RET} -ne 0 ]; then
|
if [ "$(cat /tmp/raw | grep 'Sign In</title')" != "" ]; then
|
||||||
echo "Error: Unable to authenticate"
|
echo "Error: Username and/or password incorrect"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue