小编mic*_*hal的帖子

Keycloak发送电子邮件重置密码401未经授权或500内部服务器错误

您好,我在发送电子邮件重置密码时遇到问题。我使用的是Keycloak 4.8。在文档中我发现:

向用户发送更新帐户电子邮件 电子邮件中包含一个链接,用户可以单击该链接来执行一组所需的操作。

PUT /{realm}/users/{id}/execute-actions-email
Run Code Online (Sandbox Code Playgroud)

必需的参数: idrealmactions

我使用 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 …

php guzzle keycloak

5
推荐指数
0
解决办法
2210
查看次数

Nuxt.js google AdSense返回错误支持一个标签

我将配置 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)

我该如何解决它?

adsense nuxt.js

5
推荐指数
1
解决办法
4816
查看次数

Nestjs readFileSync返回无法读取未定义的属性“readFileSync”

我尝试使用方法获取文件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,但结果是一样的

我有一个结构文件:

在此处输入图片说明

readfile node.js nestjs

4
推荐指数
2
解决办法
950
查看次数

vue2-datepicker 禁用天数范围日期

我使用 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 中不起作用

datepicker vue.js

3
推荐指数
1
解决办法
1万
查看次数

Laravel DB 表和 eloquent 方法 updateOrCreate

    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([...

但我仍然有同样的错误

php laravel eloquent

2
推荐指数
1
解决办法
8237
查看次数

Typeorm 使用类转换器来更改表​​中的值

我将 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(没有日期)。

如何将日期添加到增量值中?

nest typeorm class-transformer

2
推荐指数
1
解决办法
1万
查看次数