# Registration: Sign-up ###### Sprint: 2 ### Outcome: Users can register via an email and a strong password, then we send OTP code to this email, the user must confirm the email by entering the OTP code. ### Implementation description: #### Endpoints: POST: {$domain}/api/v2/barong/identity/users POST: {$domain}/api/v2/barong/identity/confirm_email #### File destination: {$Dalan_Path}/app/api/v2/identity/users.rb #### Commits: 42602037 Fb5162e5 f57aaf35 fb9db4ee 70104499 63f69ed0 99c25524 0ee97595 #### What did we implement? In the Opendax, users confirm their email by a unique link that is sent to their email, also in the registration process if one person uses an incorrect email, the email locks forever so the real owner of the email can not register ever. In the Zagros, the email will lock when confirming it and this confirming happens when the user enters the Six digits OTP code in the website. To send OTP code, we use Vault Service and adding action variable to distinguish every use of the Vault (for example to use it in following processes: Sign up, Change password, reset password and etc) also, email duplication in the registration process is allowed until the email confirmation or ban email in the system `Ps: action is a new variable that passes to ruby vault service.` ```mermaid sequenceDiagram Title: Sign up note over User,Ranj:starred parameters are optional User->>Ranj:email, password, *refid* Ranj->>Dalan:Post : after client side checking Dalan->>Ranj:4xx if user status is active or ban Dalan->>Ranj:4xx if email or password not valid Dalan->>User:2xx send otp to his or her mail Ranj->>User:Ask OTP code for confirming User-->>Ranj:if OTP code not received, try for resend after 120 seconds Ranj-->>Dalan:Ask for sending OTP code again Dalan-->>User:2xx send otp to his or her mail User->>Ranj: enter OTP code Ranj->>Dalan:Post : OTP code for checking Dalan->>Ranj:4xx if OTP code expired Dalan->>Ranj:4xx if user not exist in system Dalan->>Ranj:2xx create user, return user information Ranj->>User:Redirect user to the main page ```