您好,我在发送电子邮件重置密码时遇到问题。我使用的是Keycloak 4.8。在文档中我发现:
向用户发送更新帐户电子邮件 电子邮件中包含一个链接,用户可以单击该链接来执行一组所需的操作。
PUT /{realm}/users/{id}/execute-actions-email
Run Code Online (Sandbox Code Playgroud)
和必需的参数:
id
、realm
和actions
。
我使用 Guzzle 编写方法:
$client = new \GuzzleHttp\Client();
$response = $client->request('put', 'https://myserwerkeycloak.com/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email', [
'headers' => [
'User-Agent' => $_SERVER['HTTP_USER_AGENT'],
'Content-Type' => 'application/json',
'Accept' => 'application/json'
],
'form_params' => [
json_encode([
'actions' => ['UPDATE_PASSWORD'],
])
]
]);
Run Code Online (Sandbox Code Playgroud)
$response
返回 401 未经授权
所以我添加了令牌:
'Authorization' => 'Bearer ' . $access_token,
Run Code Online (Sandbox Code Playgroud)
不,我有错误 500:
local.ERROR:服务器错误:
PUT https://myserwerkeycloak.pl/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email
导致500 Internal Server Error
响应 {“异常”:“[对象](GuzzleHttp\Exception\ServerException(代码:500):服务器错误:PUT https://myserwerkeycloak.pl/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email
导致500 Internal …
我将配置 Google Adsense 添加到我的nuxt.config.js
文件中:
head: {
...
script: [
{
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
'data-ad-client': process.env.VUE_APP_GA_AD || '',
async: true,
},
],
},
Run Code Online (Sandbox Code Playgroud)
我有一个错误:
adsbygoogle.push() 错误:每页仅支持一个 AdSense 头标记。第二个标签将被忽略。
和警告:
AdSense head 标记不支持 data-n-head 属性。
在页面的源代码中,我可以看到添加到 head 标签中的代码:
<head>
...
<script data-n-head="ssr" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" data-ad-client="ca-pub-MY_NUMBER" async>
...
</head>
Run Code Online (Sandbox Code Playgroud)
我该如何解决它?
我尝试使用方法获取文件readFileSync
:
import fs from 'fs';
import path from 'path';
const templateFile = fs.readFileSync(
path.resolve(
__dirname,
'../mail/templates/exampleTemplate.html',
),
'utf-8',
);
Run Code Online (Sandbox Code Playgroud)
Nest 仍然返回错误:
类型错误:无法读取未定义的属性“readFileSync”
我尝试过 path: ./templates/exampleTemplate.html
,但结果是一样的
我有一个结构文件:
我使用 vue2-datepicker。我有日期范围:
来自: 02-10-2019
至: 07-10-2019
如果没有这个范围,我需要整天禁用。
我使用了方法disabled-days
,但我不知道如何在此函数中声明范围。我只能禁用个别日子,例如:
<date-picker
v-model="dateAccept"
range
:disabled-days="disabledDates2"
valueType="format">
</date-picker>
disabledDates2: [
new Date(2019, 10, 2), new Date(2019, 10, 6)
]
Run Code Online (Sandbox Code Playgroud)
在 vue-datepicker (版本 1)中 isset 函数:disabled-dates
但在版本 2 中不起作用
DB::table("mytable")->updateOrCreate([
'user_id' => $user_id,
'active' => 1,
'created_at' => Carbon::now()
]);
Run Code Online (Sandbox Code Playgroud)
但是此代码返回错误:
调用未定义的方法 Illuminate\Database\Query\Builder::updateOrCreate()
因此,根据此答案链接(用户stanb),我添加了:
protected $table = 'mytable';
Run Code Online (Sandbox Code Playgroud)
并更改代码:
DB::table($this->table)->updateOrCreate([
...
但我仍然有同样的错误
我将 Nest.js 与 Typeorm 和库一起使用class-transformer
:
import { Transform } from 'class-transformer';
@PrimaryGeneratedColumn()
@Transform(
({ value }) => `${value}/${moment().format('MM-YYYY')}`,
)
invoiceNumber: string;
Run Code Online (Sandbox Code Playgroud)
我正在尝试生成这样的想法:1/01-2022
。但我仍然只有一个数字,例如1
(没有日期)。
如何将日期添加到增量值中?