Last active
April 22, 2020 17:50
-
-
Save ketominer/33e08d517db850ced35d8695742ddd5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
query() | |
{ | |
PASS=$(</etc/nodl/maria-btcpay.pwd) | |
echo "$*" | mysql -u btcpay -p$PASS btcpay | |
} | |
case "$1" in | |
disable-multifactor) | |
query "DELETE FROM U2FDevices WHERE ApplicationUserId = (SELECT Id FROM AspNetUsers WHERE upper('$2') = NormalizedEmail)" | |
query "UPDATE AspNetUsers SET TwoFactorEnabled=false WHERE upper('\$2') = NormalizedEmail" | |
;; | |
set-user-admin) | |
query "INSERT INTO AspNetUserRoles Values ( (SELECT Id FROM AspNetUsers WHERE upper('$2') = NormalizedEmail), (SELECT Id FROM AspNetRoles WHERE NormalizedName='SERVERADMIN'))" | |
;; | |
reset-server-policy) | |
query "DELETE FROM Settings WHERE Id = 'BTCPayServer.Services.PoliciesSettings'" | |
;; | |
*) | |
echo "Usage: $0 [command]" | |
echo | |
echo "Commands:" | |
echo " disable-multifactor <email>" | |
echo " set-user-admin <email>" | |
echo " reset-server-policy" | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment