如何在Laravel中使用with方法将令牌传递给视图

时间:2018-11-30 16:06:33

标签: php laravel

我一直在为在我的应用程序中注册的邮件开发一个重置系统。 当用户收到邮件并单击链接时,他将被引导到我的页面,我在其中接收令牌和电子邮件以及他的新密码,并为他重置密码。

use Net::SSH::Perl;
use Term::ReadKey;
my $host = "XX.XXX.XXX.XXX";
my $user = "safeguarduser";
my $pass = "";
my $ssh = Net::SSH::Perl->new($host, options => [
"Cipher +aes256-ctr", "MACs +hmac-sha2-256", "HostKeyAlgorithms +ssh-dss"], debug => 1);
$ssh->login($user, $pass);
如您所见,

我加载的视图是向用户显示密码输入的视图。 问题是我不知道如何将此令牌发送到视图。假设我希望它在我的视图中处于隐藏输入中。

将令牌和电子邮件传递给表单的方法看起来像这样

p-066280682253: Reading configuration data C:\Users\User\.ssh\config
p-066280682253: Reading configuration data C:\WINDOWS\ssh_config
p-066280682253: Connecting to XX.XXX.XXX.XXX, port 22.
p-066280682253: Remote version string: SSH-2.0-1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01
p-066280682253: Remote protocol version 2.0, remote software version 1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01
p-066280682253: Net::SSH::Perl Version 2.14, protocol version 2.0.
p-066280682253: No compat match: 1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01.
p-066280682253: Connection established.
p-066280682253: Sent key-exchange init (KEXINIT), waiting for response.
p-066280682253: Using diffie-hellman-group-exchange-sha256 for key exchange
p-066280682253: Host key algorithm: ssh-dss
p-066280682253: Algorithms, c->s: aes256-ctr hmac-sha2-512 none
p-066280682253: Algorithms, s->c: aes256-ctr hmac-sha2-512 none
p-066280682253: Entering Diffie-Hellman Group Exchange.
p-066280682253: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<4096<8192) sent
p-066280682253: Sent DH Group Exchange request, waiting for reply.
p-066280682253: Received 2048 bit DH Group Exchange reply.
p-066280682253: Generating new Diffie-Hellman keys.
p-066280682253: Entering Diffie-Hellman key exchange.
p-066280682253: Sent DH public key, waiting for reply.
p-066280682253: Received host key, type 'ssh-dss'.
p-066280682253: Host 'XX.XXX.XXX.XXX' is known and matches the host key.
p-066280682253: Verifying server signature.
p-066280682253: Send NEWKEYS.
p-066280682253: Waiting for NEWKEYS message.
p-066280682253: Enabling encryption/MAC/compression.
p-066280682253: Sending request for user-authentication service.
p-066280682253: Service accepted: ssh-userauth.
p-066280682253: Trying empty user-authentication request.
p-066280682253: Login completed, opening dummy shell channel.
p-066280682253: channel 0: new [client-session]
p-066280682253: Requesting channel_open for channel 0.
p-066280682253: channel 0: open confirm rwindow 1048576 rmax 57344
p-066280682253: Got channel open confirmation, requesting shell.
p-066280682253: Requesting service shell on channel 0.

以及用户按下“提交”按钮时调用的方法如下:

return view($view,  ['strings'=>$strings, 'email'=>$passwordReset->email])->with('token', $token);

1 个答案:

答案 0 :(得分:0)

你为什么不这样做呢?

return view($view,['strings'=>$strings, 'email'=>$passwordReset->email, 'token' => $token]);