deis / workflow-cli

The CLI for Deis Workflow
http://deis.com
MIT License
31 stars 43 forks source link

Allow user registration without automatic login #266

Closed felixbuenemann closed 7 years ago

felixbuenemann commented 7 years ago

If a cluster is run in admin_only registration mode, it would be great if deis register had a --skip-login flag to allow creating users as an admin without logging into their account. Alternatively a users:create action would make sense, that does not require passing the controller url.

felixbuenemann commented 7 years ago

For now I've scripted around the issue with a small bash script (requires curl and jq):

#!/bin/bash
# Usage: deis-register-user <user> <pass> <email>

USER=$1
PASS=$2
EMAIL=$3
DEIS_PROFILE_PATH=~/.deis/${DEIS_PROFILE:-client}.json
DEIS_CONTROLLER=$(jq -r .controller < $DEIS_PROFILE_PATH)
DEIS_TOKEN=$(jq -r .token < $DEIS_PROFILE_PATH)

curl -fsS ${DEIS_CONTROLLER%/}/v2/auth/register/ \
  -H "Authorization: token $DEIS_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"username\":\"$USER\",\"password\":\"$PASS\",\"email\":\"$EMAIL\"}"