New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register user without registration form #164
Comments
Question 1
You can create a user manually from the REPL and skip the verification email $ cd path/2/onetimesecret
$ irb -I lib -r onetime -r securerandom
irb(main)> Then you can create a user the same way the webapp does in irb(main)> # Replicate the local vars
irb(main)> custid = 'example@example.com'
irb(main)> plan = OT::Plan.plan(:individual_v1)
irb(main)> passphrase = 'CHANGEME'
irb(main)> # OR, generate one for them
irb(main)> passphrase = SecureRandom.alphanumeric(32)
irb(main)> # Create a Customer record and save it to the database
irb(main)> cust = OT::Customer.create custid
irb(main)> # Update the customer record
irb(main)> cust.update_passphrase passphrase
irb(main)> sess.update_fields :custid => cust.custid, :authenticated => false
irb(main)> cust.update_fields :planid => plan.planid, :verified => true
irb(main)> # Create a secret pair for the new passphrase
irb(main)> metadata, secret = Onetime::Secret.spawn_pair(cust.custid)
irb(main)> secret.encrypt_value passphrase
irb(main)> secret.save
irb(main)> # `metadata` is an instance of OT::Metadata, which is for you
irb(main)> # `secret` is an instance of OT::Secret, which is for the new user
irb(main)> # From your /etc/config file
irb(main)> baseuri = Onetime.conf[:site][:host]
irb(main)> metadata_uri = 'https://%s/private/%s' % [baseuri, metadata.identifier]
irb(main)> secret_uri = 'https://%s/secret/%s' % [baseuri, metadata.identifier]
irb(main)> puts metadata_uri # => https://example.com/private/abcd...
irb(main)> puts secret_uri # => https://example.com/secret/1234... Take a look at 2. You could also write a short script that uses the APIThat would avoid interacting directly with the code. With a script you can get the manual work down to something like: $ otsuser --verbose example@example.com [planid]
Customer a1b2c3e4 created on the individual_v1 plan
For you: https://example.com/private/abcd...
For the new user: https://example.com/secret/1234...
$ otsuser example@example.com [planid]
https://example.com/secret/1234... Question 2
Every model that's stored in redis is subclassed from Familia. One of the arguments it supports is You can do a find for $ redis-cli
redis 127.0.0.1:6379> select 6
redis 127.0.0.1:6379> keys "customer:*:object"
customer:example@example.com:object Additional context
|
Hello,
I have question. We are running ots server and we would like to know if it's possible to register user (to use ots API) without working smtp or sendgrid settings? We would like to have control on users os we will create manually if needed.
Since server is publicly available we don't want non-company users to be able to register.
Also I want to know where is user info saved?
Thanks
The text was updated successfully, but these errors were encountered: