能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

huangapple go评论56阅读模式
英文:

Can We Create Custom Login Page In Azure AD B2C (User Flow or Custom Flow)

问题

I have a ReactJs app that I want to use AAD B2C to manage Identity for my users.
我有一个ReactJs应用程序,我想使用AAD B2C来管理我的用户身份。

I created the AAD B2C tenant, then registered application type SPA, then I can login using this example repo: https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/2-call-api-b2c/SPA.
我创建了AAD B2C租户,然后注册了SPA应用程序类型,然后我可以使用此示例存储库登录:https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/2-call-api-b2c/SPA。

I wonder that can I custom this login page, for example I wrote a login page in my react app contain my Logo and my site main color, I want the login page follow that style.
我想知道是否可以自定义此登录页面,例如,在我的React应用程序中编写了一个包含我的标志和网站主要颜色的登录页面,我希望登录页面遵循这种样式。

英文:

I haved an ReactJs app that I want to use AAD B2C to manage Identity for my users.
I created the AAD B2C tenant, then registered application type SPA, then I can login using this example repo: https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/2-call-api-b2c/SPA.

I wonder that can I custom this login page, for example I wrote a login page in my react app contain my Logo and my site main color, I want the login page follow that style.

答案1

得分: 1

"To create the Custom login page, refer this MsDoc as suggested by junnas."

I created a sample custom HTML page like below:

<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<h2>Login Page</h2><br>
<div id="api"></div>
<div class="login">
<form id="login" method="get" action="login.php">
<label><b>User Name</b></label>
<input type="text" name="Uname" id="Uname" placeholder="Username">
<br><br>
<label><b>Password</b></label>
<input type="Password" name="Pass" id="Pass" placeholder="Password">
<br><br>
<input type="button" name="log" id="log" value="Log In Here">
<br><br>
<input type="checkbox" id="check">
<span>Remember me</span>
<br><br>
Forgot <a href="#">Password</a>
</form>
</div>
</body>
</html>

I created an Azure Storage account and uploaded the customize-ui.html file in the container like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

And configured the CORS policy like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

When I tested the CORS policy, I got the 200 OK response:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

Now Go to Azure AD B2C User Flow -> Page Layouts -> Set Use custom page content as YES:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

When I run the user flow, the custom page is displayed successfully like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

英文:

> To create the Custom login page, refer this
> MsDoc as suggested by junnas.

I created a sample custom HTML page like below:

&lt;!DOCTYPE  html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Login Form&lt;/title&gt;
&lt;link  rel=&quot;stylesheet&quot;  type=&quot;text/css&quot;  href=&quot;css/style.css&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h2&gt;Login Page&lt;/h2&gt;&lt;br&gt;
&lt;div  id=&quot;api&quot;&gt;&lt;/div&gt;
&lt;div  class=&quot;login&quot;&gt;
&lt;form  id=&quot;login&quot;  method=&quot;get&quot;  action=&quot;login.php&quot;&gt;
&lt;label&gt;&lt;b&gt;User Name
&lt;/b&gt;
&lt;/label&gt;
&lt;input  type=&quot;text&quot;  name=&quot;Uname&quot;  id=&quot;Uname&quot;  placeholder=&quot;Username&quot;&gt;
&lt;br&gt;&lt;br&gt;
&lt;label&gt;&lt;b&gt;Password
&lt;/b&gt;
&lt;/label&gt;
&lt;input  type=&quot;Password&quot;  name=&quot;Pass&quot;  id=&quot;Pass&quot;  placeholder=&quot;Password&quot;&gt;
&lt;br&gt;&lt;br&gt;
&lt;input  type=&quot;button&quot;  name=&quot;log&quot;  id=&quot;log&quot;  value=&quot;Log In Here&quot;&gt;
&lt;br&gt;&lt;br&gt;
&lt;input  type=&quot;checkbox&quot;  id=&quot;check&quot;&gt;
&lt;span&gt;Remember me&lt;/span&gt;
&lt;br&gt;&lt;br&gt;
Forgot &lt;a  href=&quot;#&quot;&gt;Password&lt;/a&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

I created an Azure Storage account and uploaded the customize-ui.html file in the container like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

And configured the CORS policy like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

When I tested the CORS policy, I got the 200 OK response:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

Now Go to Azure AD B2C User Flow -> Page Layouts -> Set Use custom page content as YES:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

When I run the user flow, the custom page is displayed successfully like below:

能否在Azure AD B2C中创建自定义登录页面(用户流程或自定义流程)?

huangapple
  • 本文由 发表于 2023年4月19日 18:17:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76053329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定