![]() ![]() Rust provides use with really powerful tools that we can use to convert one type of error to another. Email support will get implemented next in Part 3. For now we will return the Invitation Object to the client as a workaround. If all of these conditions are true we would let the user register, otherwise send an error response back. Our server can take that id and find the Invitation object in the database and then compare the expiry date with current time. We can send a request to register a new user with the above UUID in the url. Let's say the client gets an invitation after entering their email with uuid 67a68837-a059-43e6-a0b8-6e57e6260f0d. We could use the UUID from the invitation object as a secret. The simplest way of creating an email verification is to have our server to use some sort of secret sent via the email to the user email and have them click an link with the secret to verify. WARNING: Do not use this workaround in any real app without proper email verification.įor now we will use the http response from the server to verify the email so to speak. The service that I use is sparkpost and you as the reader of this tutorial may not have an account with them(which is free for small usage). In part one I said that we will send an email to the user, after some thought and feedback, we will be skipping this part now (look out for part 3). Picking up from part one, we now have as server that takes an email address from a request and spits out a JSON response with an invitation object. Complete code for this tutorial is on Gitlab master branch. Checkout Part One if you haven't already. Congratulations if you have your app running and no errors so far. In part one we have successfully setup bulk base of our Auth microservice. do a lot of initialization here let host = "127.0.0.This post is outdated now please read the updated version Auth Web Microservice with rust using Actix-Web 1.0 - Complete Tutorial Pub async fn init (_args: Vec, routes: Vec>) I wrote this fairly simple piece of code to show how I want to use the wrappers: use actix_web:: In order to avoid users of my library having to include actix-web and actix-rt as a dependency, the init function should take in my own version of Route and then spin up the system and its arbiters. I want to hide all of the initialization logic of the library I'm currently writing inside the init function. I'm trying to write a simple wrapper around all the parameters that are needed to create actix Routes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |