Skip to content

Resolve "Add phone verification page"

Martin Tan请求将1434-add-phone-verification-page合并到main-jh

What does this MR do and why?

To let users have the ability to update the phone on a separated page compared with registration page, we need to add two APIs, one for hosting the phone verification form, one for processing the form data.

The skipped before_actions are all from TermsController except skip_before_action :required_signup_info which is for skipping welcome page. For the page redirections, they are going to be handled in #1436 as a sibling issue.

The phone format is validated on SMS sending action, phone format validator is not required for now, a tech debt issue is created for this #1607.

  • Add phone verification page
  • Add an action to verify code

API

API List

1, Show the phone verification page

GET {YOUT_HOST}/-/users/phone

2, Update user phone

POST {YOUT_HOST}/-/users/phone/verify

Payload

authenticity_token: 43/YccfqYtENv1b/eSkNP8i9A/SD+OPK3/OTU2TWxAsaSlV709HvxOmUnHE6JMKGg3hPMRXExKmKZbMHlYb/6A==
area_code: +86
phone: 18516261234
verification_code: 234123

API Pattern

The API URL follows the pattern of terms

 $ rails routes | grep '/-/users/'
verify_phone POST                  /-/users/phone/verify(.:format)                                                                                                 users/phones#verify
       phone GET                   /-/users/phone(.:format)                                                                                                        users/phones#show
 accept_term POST                  /-/users/terms/:id/accept(.:format)                                                                                             users/terms#accept
decline_term POST                  /-/users/terms/:id/decline(.:format)                                                                                            users/terms#decline
       terms GET                   /-/users/terms(.:format)                                                                                                        users/terms#index
    callouts POST                  /-/users/callouts(.:format)                                                                                                     users/callouts#create
group_callouts POST                /-/users/group_callouts(.:format)                                                                                               users/group_callouts#create

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Relates to #1434 (closed)

Martin Tan 编辑于

合并请求报告

加载中