This is the first time I am building a Laravel web service for mobile app, so I am not sure if I am doing right, even if it works. When a user asks for registration from app via a form consisting of name, mobile, email, password, password_confirmation
, a 5 digits code
must be sent to its mobile via SMS , then it must reply that SMS to web service to verify its mobile number, if it is valid, I return an app_token
for that user and store this token in the database. By this token and user's email I can verify requests coming from that user are valid.
This is the architecture of What I am going to do
This is the details if steps:
- At Step 1 form consisting of
name, mobile, email, password, password_confirmation
is sent to the server. - Web service stores the user as inactive in the database and creates a 5 digits
code
for this user. It also stores thecode
in the database for this inactive user. Then at step 2 it asks the SMS system to send thecode
to the mobile number. - At step 3 the user must reply the pair (SMS, email) to the server.
- If the SMS is associated with the given email in the database, then I generate an
app_token
for the user and return it via JSON to the application and store thisapp_token
in the database.
So the User
table consists of name, mobile, email, password, remember_token, created_at, updated_at, app_token, app_token_expire
.
To implement this I create a post
route for each step and simply manage this using a function.
I would like to know if this process is right? Like I said this is the first I'm going to create such application so I have no idea about the right way of doing this. Any advice for architecture and implementation would be appreciated.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OUjMeL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire