1

I have an api built with Django Rest framework and a Front end that's built with Angular

For the reset password functionality, when the user clicks on the reset password they should provide email within a reset password component on Angular. Then via submit action It hits the POST method of reset_password with the email in the body.

Then the reset password controller should send an email to the user with this format base_url/reset_password/<token>

When the user hits this url, they should be redirected to a reset password form with new password and confirm password

The Question is: Where should this template be stored? Angular component or Django template?

What is the best practice for such case?

4
  • create reset password component and set route resetpassword get token from API create authGuard for reset password set on route and redirect on reset page if reset token is valid and send reset password with token in your server and update it. Commented Jan 9, 2019 at 15:30
  • It depends on you app architecture. Can you provide the code? I mean, if you made the app with Angular, I guess the end-user should be redirected to a specific page/component you provided for it. don't mess it with django template Commented Jan 9, 2019 at 15:32
  • I mean this functionality specifically. @RoiSadika Can i just make the /reset_password/<token> render a reset form that is stored in the API and do everything for this functionality server side as it will use less requests as i can validate the token on the and if failed i render expired token template for example. Commented Jan 9, 2019 at 15:33
  • @MohamedHamza The reset password functionality should be a call to the API and you should also provide a service in Angular to use it. Commented Jan 9, 2019 at 15:41

1 Answer 1

1

I'd go with Angular component option due to the role of separation between UI and the data when you have a restful backend and a single page app.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.