{"id":44,"date":"2024-12-06T15:02:49","date_gmt":"2024-12-06T14:02:49","guid":{"rendered":"http:\/\/rarathemesdemo.com\/perfect-portfolio\/?post_type=rara-portfolio&#038;p=44"},"modified":"2024-12-16T09:45:19","modified_gmt":"2024-12-16T08:45:19","slug":"luke-in-the-house-of-jelly-radio-fenzes-7","status":"publish","type":"rara-portfolio","link":"https:\/\/portfolio.articole-smart.eu\/index.php\/portfolio\/luke-in-the-house-of-jelly-radio-fenzes-7\/","title":{"rendered":"2fa Authenticator sur Laravel (SMS&amp;Email)"},"content":{"rendered":"\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary><\/summary>\n<p class=\"wp-block-paragraph\">\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La s\u00e9curit\u00e9 de l&rsquo;application s&rsquo;am\u00e9liore avec la 2FA. Configurer des notifications de mot de passe \u00e0 usage unique (OTP) par e-mail ou SMS devient tr\u00e8s important. Ajouter facilement votre application \u00e0 Google Authenticator ou Microsoft Authenticator.<\/p>\n\n\n\nngg_shortcode_0_placeholder\n<\/details>\n\n\n\n<p class=\"wp-block-paragraph\">La s\u00e9curit\u00e9 de l&rsquo;application s&rsquo;am\u00e9liore avec la 2FA. Configurer des notifications de mot de passe \u00e0 usage unique (OTP) par e-mail ou SMS devient tr\u00e8s important. Ajouter facilement votre apllication \u00e0 Google Authenticator ou Microsoft Authenticator.<\/p>\n\n\n\nngg_shortcode_1_placeholder\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class User extends Authenticatable\n{\n    protected $fillable = [\n        'name',\n        'email',\n        'password',\n        'two_factor_code', \/\/ [tl! add]\n        'two_factor_expires_at', \/\/ [tl! add]\n    ];\n    \/\/ ...\n\npublic function generateTwoFactorCode(): void\n{\n    $this-&gt;timestamps = false;  \/\/ Prevent updating the 'updated_at' column\n    $this-&gt;two_factor_code = rand(100000, 999999);  \/\/ Generate a random code\n    $this-&gt;two_factor_expires_at = now()-&gt;addMinutes(10);  \/\/ Set expiration time\n    $this-&gt;save();\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">User<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">extends<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Authenticatable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">protected<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$fillable<\/span><span style=\"color: #D4D4D4\"> = [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #CE9178\">&#39;name&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #CE9178\">&#39;email&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #CE9178\">&#39;password&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #CE9178\">&#39;two_factor_code&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #6A9955\">\/\/ [tl! add]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #CE9178\">&#39;two_factor_expires_at&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #6A9955\">\/\/ [tl! add]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    ];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\">\/\/ ...<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">generateTwoFactorCode<\/span><span style=\"color: #D4D4D4\">(): <\/span><span style=\"color: #569CD6\">void<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #9CDCFE\">timestamps<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">false<\/span><span style=\"color: #D4D4D4\">;  <\/span><span style=\"color: #6A9955\">\/\/ Prevent updating the &#39;updated_at&#39; column<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #9CDCFE\">two_factor_code<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">rand<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">100000<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">999999<\/span><span style=\"color: #D4D4D4\">);  <\/span><span style=\"color: #6A9955\">\/\/ Generate a random code<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #9CDCFE\">two_factor_expires_at<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">now<\/span><span style=\"color: #D4D4D4\">()-&gt;<\/span><span style=\"color: #DCDCAA\">addMinutes<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">10<\/span><span style=\"color: #D4D4D4\">);  <\/span><span style=\"color: #6A9955\">\/\/ Set expiration time<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #DCDCAA\">save<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>La s\u00e9curit\u00e9 de l&rsquo;application s&rsquo;am\u00e9liore avec la 2FA. Configurer des notifications de mot de passe \u00e0 usage unique (OTP) par e-mail ou SMS devient tr\u00e8s important. Ajouter facilement votre apllication \u00e0 Google Authenticator ou Microsoft Authenticator.<\/p>\n","protected":false},"author":1,"featured_media":576,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"rara_portfolio_categories":[19,15,16],"class_list":["post-44","rara-portfolio","type-rara-portfolio","status-publish","has-post-thumbnail","hentry","rara_portfolio_categories-backend","rara_portfolio_categories-laravel","rara_portfolio_categories-php"],"_links":{"self":[{"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/rara-portfolio\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/rara-portfolio"}],"about":[{"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/types\/rara-portfolio"}],"author":[{"embeddable":true,"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/comments?post=44"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/media\/576"}],"wp:attachment":[{"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"rara_portfolio_categories","embeddable":true,"href":"https:\/\/portfolio.articole-smart.eu\/index.php\/wp-json\/wp\/v2\/rara_portfolio_categories?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}