cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sidhant_02
Post Prodigy
Post Prodigy

Reset password functionality

Hi,
I am trying to implement a reset password functionality in my Sample canvas app for which I am using SharePoint list as data source. In the SharePoint list there are two columns named: title(username) and password. I have created a button on the login screen named Reset button which navigates to Forgot password screen, in which I have used a Edit form with datasource: Sharepoint List (Login List), so I want to change password for the records (w.r.t username: it should be used a reference to change password) that are present in the list not any random record.

So I referred one of the questions on Community: Update Password using SharePoint list (Link: https://powerusers.microsoft.com/t5/Building-Power-Apps/Update-Password-using-SharePoint-list/m-p/68...
But I was facing one issue that on the screen it displayed 'No Items to display'. So I have replied on the above answer. I am attaching some screenshots of my app for your reference, please let me know if it is correct and how to achieve the change password functionality.

Login Screen:

Sidhant_02_0-1672390073004.png


Login list:

Sidhant_02_1-1672390109716.png


Forgot Password page:

Sidhant_02_2-1672390196401.png


For Title and Password field, Default value set to empty: (Unlocked the data card)

Sidhant_02_3-1672390280180.png


Submit button:

Sidhant_02_4-1672390314451.png

 

(Expected Outcome:
1. User clicks on Reset Password button
2. On Forgot password page enters the username and password (the username should be used for comparing if that record exists, if it does then only the change the password field and update the password field column for that record)
3. After user clicks Submit display message: Password changed (optional) and then navigated to login screen.
)

1 ACCEPTED SOLUTION

Accepted Solutions
KeithAtherton
Most Valuable Professional
Most Valuable Professional

My pleasure. The new code is looking good!

 

To prevent the Patch, Navigate, etc running if the password input is left blank, I would move all of the code highlighted in orange below into the else part part of the "If(locIsValid," statement:

 

KeithAtherton_1-1673360988809.png


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

14 REPLIES 14
KeithAtherton
Most Valuable Professional
Most Valuable Professional

Hi @Sidhant_02,

 

It looks like the form filters 'Login List' on Title and Password but should it filter on Title only as that is the only info that the user knows at this point?

KeithAtherton_0-1672408292800.png


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @KeithAtherton ,

Yes the user knows only the username. So should I remove the second condition as I was referring to another forum question which was quite similar to my requirement in which both the username and password fields were being used.
Reference link:
Solved: Update Password using SharePoint list - Power Platform Community (microsoft.com) (See the first response)

KeithAtherton
Most Valuable Professional
Most Valuable Professional

Ah, I see, thanks for sharing the link to the other forum question.

 

Yes, exactly; remove the second condition as we only want to match on the user name, like this:

Title = Textinput1.Text

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @KeithAtherton ,
I was able to implement the Reset functionality just had to make some changes in the expression. Instead of using the Edit form I retrieved the user details from the login screen (for that every time I need to type the username on the Login screen) and then navigate to ForgotPassword screen.

Sidhant_02_0-1673249769643.png

And OnSelect of the submit I added the following:

Sidhant_02_1-1673249848696.png

The password is getting reset, but while testing I observed that even after providing password as blank and on-clicking submit the application was getting navigated to Success screen and did not execute the if part

Login list (Before setting the password field to blank):

Sidhant_02_2-1673250009534.png

 

Sidhant_02_3-1673250059245.png

In the above image I have left the password field blank and when I clicked on Submit button it navigated to Sucess screen

Sidhant_02_4-1673250119736.png

In SharePoint List it displayed:

Sidhant_02_5-1673250155186.png

So could you please let me know what is going wrong?

KeithAtherton
Most Valuable Professional
Most Valuable Professional

Good news that the password reset now works!

 

Unfortunately I cannot investigate the If logic further as I cannot see what Errors('Login List') contains, which is potentially where the issue is.

 

However, I would recommend checking if the password is non-blank before the Patch function is called, that way the SharePoint List is kept as accurate as possible.

 

If you do need to check for errors in Power Apps, the IfError function can be used. More info: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-iferror


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @KeithAtherton ,
I was able to show a notification message if the password field is left blank, but now I wanted to know can I add multiple conditions in a if statement and if it is satisfied then navigate to a error screen (created by me).
In my case I want to check if there any errors in the SharePoint list already or if the user has left the password filed as blank then the notification should be shown and Navigated to a custom screen. Else the password is reset (if there are no errors in the list or the password input field was filled)

Sidhant_02_0-1673330916404.png

The above expression is executed onSelect of Submit button in the Forgot password page:

Sidhant_02_1-1673330983800.png

If the user leaves the password field blank then I I have used IsBlank which is working. What I want is if there is any issue in the list or field is blank then the Incorrect Password screen must be shown (which I have created):

Sidhant_02_2-1673331130244.png

Otherwise if everything is fine then the confirmation screen must be shown:

Sidhant_02_3-1673331170547.png


So I did try to put the Navigate option in the if-block and outside the second condition, this kept executing the error message block even if I have entered the password field and should show confirmation screen not incorrect password screen

Sidhant_02_0-1673333361413.png

 

 

Sidhant_02_1-1673333405921.png

 



What changes do I need to make?

KeithAtherton
Most Valuable Professional
Most Valuable Professional

It looks like the "|| IsBlank(TextInput3)" line may be causing an issue, and the order of the logic will likely cause issues as it's attempting to patch the record before checking if the password field is blank.

 

I'd suggest breaking the logic down and re-writing the code. For example, in pseudo code:

If password field is blank, notify user then stop processing.
Patch list record, notify user if successful.
If list contains errors, notify user and navigate to Incorrect Password screen.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @KeithAtherton ,
I did try to implement the pseudocode which you mentioned but did not understand how to stop the process and in power apps do we have else if and else. This is what I understood:

Sidhant_02_0-1673354711804.png

If possible could you give the correct expression as per your pseudocode

KeithAtherton
Most Valuable Professional
Most Valuable Professional

A few comments on the code in the screenshot:

  • Patch function call needs a couple of closing brackets before the Navigate function is called.
  • The last Notify function call needs a closing bracket.
  • Hover over the red underlines to get error details to help you resolve the issues.

 

A useful way of stopping processing is to do similar to the following:

UpdateContext({locIsValid:<Your boolean logic>});

If(locIsValid,
  <Your actions>
);

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!      

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

October 2023: Celebrating New User Groups & Events to Check Out!

It's time for our monthly celebration of new user groups that recently joined our community, along with events happening nearby--or even virtually!  There's so much going on our community, it's a great time to pause and celebrate what is happening in our user groups and in our community this October!   PLEASE WELCOME THESE NEW USER GROUPS: Biz Apps Community User Group - Power Platform Community (microsoft.com)  This user group is dedicated for any community members of all skill levels to learn how to get the most out of their community experience. East Michigan Power Platform User Group - Power Platform Community (microsoft.com)  This is the start of a new community covering eastern Michigan, built around the Power Platform. Biz Apps Community User Group  This user group is dedicated for all community members of all skill levels to learn how to get the most out of their community experience.   EVENTS TO CHECK OUT: IN-PERSON AND ONLINE In-Person: September 2023 Hybrid Philadelphia Dynamics 365 & Power Platform User Group Meet  Dynamics 365 and Power Platform Physical Meetup  Hyderabad Power Platform User Group Meetup - Sept 2023 (In-Person)  Manchester September 2023 In Person Meeting  Virtual: Everything Dataverse, Do you know that Dataverse is more than just a Database! POWER PLATFORM MONTHLY DIGEST- SEPTEMBER Baltic Summit 2023 PL-900 Power Platform Fundamentals Training HR and L&D transformation through Power Platform Dynamics 365 Marketing Experience User Groups - Use Cases and Networking Power Platform and Dual Write from Dynamics 365 F&O Perspective ANZ D365 FinOps Team September 2023 meetup 

Top Solution Authors
Top Kudoed Authors
Users online (4,249)