Initial commit: git-hangman-lab and keycloak-hangman-lab skills
This commit is contained in:
19
git-hangman-lab/scripts/git/reset-password
Executable file
19
git-hangman-lab/scripts/git/reset-password
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Get username from pass_mgr
|
||||
username=$(pass_mgr get-username --key git)
|
||||
if [[ -z "$username" ]]; then
|
||||
echo "Error: No username found in pass_mgr for key 'git'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate new password
|
||||
password=$(pass_mgr generate --key git --username "$username")
|
||||
|
||||
# Update password via gitea admin
|
||||
"$SCRIPT_DIR/gitea" admin user change-password --username "$username" --password "$password" --must-change-password=false
|
||||
|
||||
echo "Password updated for user: $username"
|
||||
Reference in New Issue
Block a user