1
votes

I've setup a custom policy in B2C that combines all 3 main operations: sign in, sign up and reset password. The sign up and reset password pages both support a CANCEL button, which ends the user journey and returns an AAD error code.

[Update] For clarification, the policy starts with asking for login credentials. It also offers "Forgot password" and a "Sign up" link. Both are linked to further orchestration steps to show the relevant screen. Its those that have the CANCEL. And when pressed, I want to go back to the first screen that asks for the credentials.

Is there a way to express within the UserJourney that when a CANCEL occurs, it should go back to OrchestrationStep = 1?

2
what you intend to do when user clicks cancel?Abhishek Agrawal
As I said - go back to the first orchestration step, i.e. display the login screen again.Stephan Hoffmann
Will that not be an infinite loop? Curious to understand the scenario.Abhishek Agrawal
Why should this be infinite? You start, see login, click Signup, err wrong, cancel and back to signin. Same for reset. As soon as I signup, signin or reset my password successfully I am ending the journey.Stephan Hoffmann

2 Answers

0
votes

I think the only control available is to skip an orchestration step in a policy. Based on AAD error code. You have two options

  1. Catch the error code generated out of cancellation and redirect to policy again.
  2. Hide B2C's cancellation button, using javascript. Implement a button yourself which will mimic back button behavior.
0
votes

As @Abhishek Agrawal mentioned, there is no native way (i.e. - an xml policy configuration parameter you can set) to add a restart-flow/login button to the signup page.

If your main aim is to just navigate from '/signup' baack to '/signin', I would recommend adding the following html to your template, which you can then style to your liking:

(Note the call to `history.back()` on the anchor tag)
<body>
    <div class="container unified_container">
      <div class="row">
        <div class="col-lg-6">
          <div class="panel panel-default">
            <div class="panel-body">
              <div id="api"></div>
              <div id="signinContainer">
                <p>
                  Already Registered?
                  <a
                    id="signinLink"
                    type="submit"
                    aria-disabled="false"
                    aria-label="To Sign in screen"
                    href="javascript:history.back()"
                    >Log in</a
                  >
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>

Alternatively, if you know that you will want to go back a specific number of times (for example, back 3 pages), you can use the following instead of the history.back() we saw above:
history.go(-3);