Tribe Support

Tribe Support's Topics

Akgora Flip

Akgora Flip

1 week ago

Addiition of extra field of phone number in signup

Hi Rastin, hope you are doing well...!!!

I would like to add extra filed of phone number to signup, as i am using this as api for mobile app.  Could you walk me through on how to implement it .

This is a feature that needs to be in the core code. If you add it yourself, then you'll have a hard time upgrading to the future releases of Anahita. I'm going to add the phone number field(s) in the next release. For the time being, you can work on the other features of your projects until we get the next release out within the next couple of weeks.
Ok, so I just looked at the Twilio Authy Users API. I don't think we even need to store phone numbers in Anahita, but we need to store the authy_id in the Anahita person node for later use. So in theory you need to develop an Anahita user plugin and an authentication plugin. You can name both TwilioAuthy or TAuthy

In your user plugin:

1. when signing up a user for the first time in Authy user plugin method onAfterAddPerson you can register a new user with the Authy API and obtain an authy_id, then store it in the Anahita person object for later use $person->setValue('authy_id', 123)->save();

2. in order to send a one-time password request to Authy, you need to build an Anahita app called com_authy with an endpoint that loads person object by email or username and then obtains authy_id $person->getValue('authy_id'); and this triggers an SMS message or push-notification to be sent to the phone.

3. in the TAuthy authentication plugin, obtain the person object and authy_id value as well as the Authy token sent to the phone and make a call to Authy API to verify the user. If TRUE, then log in the user.

Basically it is the Twilio Authy that stores phone numbers, not Anahita. Which is more secure when you think about it.

These are example Anahita plugins for you to look into:

#Twilio #Authy
Akgora Flip liked this
Hi Rastin,

That was really informative. I have another query regarding how to write customized API endpoint as per requirement. Is there any standard protocol to write it on own could you walk us through this in detail.
Rastin Mehr liked this
Fork the Anahita standard repo and use it for developing your custom project:

You will be building your apps in the packages directory and maintain them in your fork. The best reference is the existing Anhaita packages. They contain most case scenarios that you might need:

If not, also look into the Anahita's core code in the src/components and src/plugins directory.

Don't invest in building any HTML rendering views. We are going to remove them all. Use Anahita only as an API backend. We keep improving the API right now and updating the master branch.
Hi Rastin that was informative as well, i really appreciate your quick response extending your support to our queries. Regarding the suggestion of user plugin(Authy) i am little confused on how to build a user plugin, it would be very helpful if you walk us on that mobile number issue in detail step by step. Also as an alternative can we store that field (Please select a unique username) on signup page with number replacing the string though it is VARCHAR in DB, but i think that is being validated in other function/page to store as string in DB could you help us on this.

Powered by Anahita