Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    automated user registration

    Feature Requests
    registration
    5
    10
    460
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fair last edited by girish

      Hi,

      We have a lot of users and don't always know who needs access to our cloudron setup. Is there a way to automate user registration or that registration is open, but for instance moderated?

      A setup that would work well for us:

      • user registers their account on cloudron
      • (optionally, but nice) if their email isn't in the whitelist, continue, else decline registration
      • add to moderation queue
      • moderator approves or declines, this could even be that the user already exists but needs adding to groups.

      If that isn't possible, which would be sad, being able to mass invite a list of e-mail addresses or sent a single invite link to a mailinglist would also work.

      Setting the registration deadline would also be quite helpful here, very few people respond to their invite within a day.

      Thanks!

      marcusquinn ? 2 Replies Last reply Reply Quote 3
      • girish
        girish Staff last edited by girish

        @fair Currently, there is no way to have self-registration. I guess this request is similar to https://forum.cloudron.io/topic/2068/is-it-possible-to-have-open-registation . You can use the API to implement bulk invites - https://cloudron.io/documentation/api/#/paths/~1users/post . Would that work?

        jdaviescoates 1 Reply Last reply Reply Quote 3
        • marcusquinn
          marcusquinn @fair last edited by marcusquinn

          @fair Use a Mailtrain List & Subscription Form in the meantime maybe?

          At least it would capture the interest, has no time limit, and should be easy enough to send reminders to those not subscribed.

          We're not here for a long time - but we are here for a good time :)
          Jersey/UK
          Work & Ecommerce Advice: https://brandlight.org
          Personal & Software Tips: https://marcusquinn.com

          1 Reply Last reply Reply Quote 2
          • jdaviescoates
            jdaviescoates @girish last edited by

            @girish said in automated user registration:

            I guess this request is similar to https://forum.cloudron.io/topic/2068/is-it-possible-to-have-open-registation

            You beat me to it 🙂

            Perhaps move that and this thread to feature requests?

            I use Cloudron with Gandi & Hetzner

            F 1 Reply Last reply Reply Quote 1
            • girish
              girish Staff last edited by

              @jdaviescoates Done!

              @fair For now, I can write a script and publish it here. Let's take it from there.

              1 Reply Last reply Reply Quote 3
              • ?
                A Former User @fair last edited by

                @fair said in automated user registration:

                if their email isn't in the whitelist, continue, else decline registration

                for "isn't" read "is" (?)

                1 Reply Last reply Reply Quote 2
                • F
                  fair @jdaviescoates last edited by

                  @jdaviescoates This looks quite interesting, I'm currently trying to make a script that will make users. But I think I'm missing bits and/or the docs are out of date. I manage to login, but get these fields back:

                  • accessToken
                  • tokenScopes
                  • identifier
                  • clientId
                  • expires

                  What I'm missing is what to do with those fields. Having them as cookies doesn't seem to work 🙂

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    fair @fair last edited by

                    Got authentication working, requesting status works, but when I want to get a list of users with /api/v1/users

                    I get:

                    {
                    "status": "Unauthorized",
                    "message": "Unauthorized"
                    }

                    I also get this when trying to use this from the browser, but this is using the admin user.

                    1 Reply Last reply Reply Quote 0
                    • girish
                      girish Staff last edited by

                      @fair The status call doesn't require auth which is why maybe you think it work (but it doesn't). I tried quickly, this is how it should work:

                      $ curl https://my.demo.cloudron.io/api/v1/users?access_token=0c65ac11c01b894f29ae24e47023982b2e81413f45324af8b5be22cc65a4c61d
                      {
                        "users": [
                          {
                            "id": "uid-519b3541-7f42-4132-b1fc-225361b7c4a7",
                            "username": "ahoruz",
                            "email": "removed",
                            "displayName": "Ali",
                            "active": true
                          },
                          {
                            "id": "uid-d9e1bd2b-1214-4fec-9cac-d6cdeaf62bcd",
                            "username": "cloudron",
                            "email": "admin@cloudron.io",
                            "displayName": "cloudron",
                            "active": true
                          }
                        ]
                      }
                      
                      1 Reply Last reply Reply Quote 2
                      • girish
                        girish Staff last edited by

                        @fair Here's a script to create a user and invite them.

                        #!/bin/bash
                        
                        set -eu
                        
                        # fill these in
                        cloudron=my.domain.com
                        token=a803859d40c9ec4e111ccb111111111111111111111
                        
                        # the user to add and invite
                        username=test
                        email=test@cloudron.io
                        displayName="Test User"
                        
                        function urlencode() {
                            # https://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding
                            python2.7 -c "import sys, urllib as ul; print(ul.quote_plus(sys.argv[1]))" $1
                        }
                        
                        # add user
                        if ! out=$(curl -sS --fail -H 'Content-Type: application/json' -X POST -d "{ \"email\": \"${email}\", \"username\": \"${username}\", \"displayName\": \"${displayName}\" }" https://${cloudron}/api/v1/users?access_token=${token}); then
                            echo "Failed to add user"
                            exit 1
                        fi
                        userid=$(echo ${out} | jq -r .id)
                        echo "User added: ${userid}"
                        
                        # create an invite. this does not send the email. if you like you can share the invite link using other channels
                        if ! out=$(curl -sS --fail -H 'Content-Type: application/json' -X POST https://${cloudron}/api/v1/users/${userid}/create_invite?access_token=${token}); then
                            echo "Failed to create invitation"
                            exit 1
                        fi
                        resetToken=$(echo ${out} | jq -r .resetToken)
                        encodedEmail=$(urlencode "${email}")
                        encodedDisplayName=$(urlencode "${displayName}")
                        echo "reset token: ${resetToken} . URL for user to sign up: https://${cloudron}/setupaccount.html?resetToken=${resetToken}&email=${encodedEmail}&displayName=${encodedDisplayName}&username=${username}&profileLocked=true"
                        
                        # tell cloudron to send the invite by mail. invite links are only valid for a day from when they were created
                        if ! out=$(curl -sS --fail -H 'Content-Type: application/json' -X POST https://${cloudron}/api/v1/users/${userid}/send_invite?access_token=${token}); then
                            echo "Failed to send invitation"
                            exit 1
                        fi
                        echo "Invitation sent"
                        
                        
                        1 Reply Last reply Reply Quote 3
                        • Referenced by  fbartels fbartels 
                        • Referenced by  fbartels fbartels 
                        • Referenced by  jdaviescoates jdaviescoates 
                        • First post
                          Last post
                        Powered by NodeBB