我已经创建了自定义注册页面在Azure广告b2c,但JavaScript是不工作.
我还在属性中启用了[Enable JavaScript enforcement page layout]选项,
***目前我使用的是用户流而不是自定义策略
自定义页面示例:
<!DOCTYPE html>
<!-- saved from url=(0080)../assets/AzureBlue/selfAsserted.cshtml -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sign up</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://demostorage.z11.web.core.windows.net/slate_gray/css/assets.css" rel="stylesheet" type="text/css" />
<link href="https://demostorage.z11.web.core.windows.net/slate_gray/css/common.css" rel="stylesheet" type="text/css" />
<link href="https://demostorage.z11.web.core.windows.net/slate_gray/css/selfasserted.css" rel="stylesheet" type="text/css" />
<style>
.tnc-container {
height: 100px;
overflow-y: scroll;
text-align: left !important;
border: 1px gray solid;
padding: 5px;
margin: 20px 0px 0px 0px;
}
.buttons #continue {
float: none !important;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
var checkbox = document.querySelector("input[type=checkbox]");
checkbox.addEventListener( 'change', function(e) {
var currentdate = new Date();
var datetime = currentdate.getFullYear() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getDate() + " "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
this.value = datetime;
});
}, false);
</script>
</head>
<body>
<div class="container self_asserted_container ">
<div class="row">
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-body">
<img alt="Company Logo" class="companyLogo" src="https://demostorage.z11.web.core.windows.net/assets/images/logo.svg">
<div id="api">
</div>
<div class="tnc-container">
<b>Terms and Conditions Sample Generator</b> <br>
Help protect your website and its users with clear and fair website terms and conditions. These terms and conditions for a website set out key issues such as acceptable use, privacy, cookies, registration and passwords, intellectual property, links to other sites, termination and disclaimers of responsibility. Terms and conditions are used and necessary to protect a website owner from liability of a user relying on the information or the goods provided from the site then suffering a loss.
Making your own terms and conditions for your website is hard, not impossible, to do. It can take a few hours to few days for a person with no legal background to make. But worry no more; we are here to help you out.
All you need to do is fill up the blank spaces and then you will receive an email with your personalized terms and conditions.
</div>
</div>
</div>
</div>
</div>
</div>
</body></html>
我在本地测试了这个JavaScript...它工作正常。
使用JavaScript函数,我想在复选框“服务同意团队”检查中存储当前日期时间
2条答案
按热度按时间wfveoks01#
您可以使用
CombinedSignUpAndSignIn
策略,并可以通过以下过程显示复选框转到用户流属性。
1.选择
Page layout
。1.选择“本地帐户注册页面”。
1.在
User Attributes
下,找到你的属性,它应该是布尔值。1.将
User input type
设置为CheckboxMultiSelect
。然后转到“用户流”中的“语言”菜单。
1.启用
Language Customisation
。1.下载
'Local account sign up page'
的英语默认语言文件。1.查找
"LocalizedCollections"
中的扩展属性名称。1.按如下方式添加一个值:
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-language-customization#provide-a-list-of-values-by-using-localizedcollections
保存您的文件,并将其作为覆盖内容上传到英语本地化。您现在应该看到复选框,如果选中,它将返回
True
,如果未选中,则返回False
。有一个与此相关的sample,它显示一个复选框,并写入所显示的TOU的 * 版本 *。
TOU需要由您的HTML customisation提供,或者您可以将其写入
paragraph
声明中。p3rjfoxz2#
我一直在努力解决这个问题,最初认为这可能是我们加载页面的存储帐户上的CORS问题。结果是他们在“页面布局版本”2.1.21中破坏了JavaScript。我还没有测试过所有的版本,但JavaScript似乎可以在2.1.20及以下版本上工作。