You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
699 B
Bash

#!/bin/bash
domain=$1
output_file=$2
read -p "User: " user
read -p "Password: " password
if [ -e $output_file ]; then
output_file=matrix-login.txt
fi
if [ -z $domain -o -z $user -o -z $password ]; then
echo "Domain: $domain, User: $user, Password: $password"
echo "Usage: $0 \"https://matrix.server\" <OUTPUT_FILE>"
exit 0
fi
echo "Querying homeserver for new login data ..."
echo curl -XPOST -d "{\"type\":\"m.login.password\", \"user\":\"$user\", \"password\":\"$password\"}" "$domain/_matrix/client/r0/login" -o "$output_file"
curl -XPOST -d "{\"type\":\"m.login.password\", \"user\":\"$user\", \"password\":\"$password\"}" "$domain/_matrix/client/r0/login" -o "$output_file"