Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/bin/zsh
  2.  
  3. username=$1
  4. password=$2
  5. db=synapse-homeserver
  6.  
  7. [[ -z $username ]] || [[ -z $password ]] && { print "usage: $0 <username> <password>"; exit; }
  8.  
  9. password_hash=$(python -c "import bcrypt; print bcrypt.hashpw(\"$password\", bcrypt.gensalt())")
  10.  
  11. echo $password_hash
  12. psql -c "update users set password_hash = '$password_hash' where name = '$username'" $db
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement