Now to rename input password in Laravel 5.4? - php

I have a project for Laravel which includes wordpress. They have a common database. When registering the user, the data is entered into the user table when I click forgot the password and enter the email. I receive a link with a token on which it is possible to reset the password, but when I enter the password an error is output that the password is not compatible. How can this be remedied?
That's what I have:
<form method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-envelope" aria-hidden="true"></i>
</span>
<input id="email" type="email" name="user_email" value="{{ old('user_email') }}" required autofocus
placeholder="email">
</div>
#if ($errors->has('user_email'))
<span class="error-block">
<strong>{{ $errors->first('user_email') }}</strong>
</span>
#endif
<div class="spacer-20"></div>
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
<input id="password" type="password" name="user_pass" required placeholder="Password">
</div>
#if ($errors->has('user_pass'))
<span class="error-block">
<strong>{{ $errors->first('user_pass') }}</strong>
</span>
#endif
<div class="spacer-20"></div>
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
<input id="password-confirm" type="password" name="password_confirmation" required placeholder="Retype Password">
</div>
#if ($errors->has('password_confirmation'))
<span class="error-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
<div class="spacer-20"></div>
<div>
<button type="submit" class="btn btn-nim btn-nim-clear" style="width: 100%">
reset password
</button>
</div>
</form>
Where do I change the password on user_pass?

Laravel unfortunately has the password field name hardcoded. The easiest option to work around that would be just to copy the value of user_pass to password in your controller before the default Laravel logic is applied.
public function reset(Request $request)
{
$request->request->set('password', $request->user_pass);
return parent::reset($request);
}

Related

Modal Uncaught TypeError: Illegal invocation

I'm developing a laravel project. After logging in with modal, I tried to register with modal, but I encountered an error. I'm waiting for your help. I WILL SHARE THE SEAMLESS PART AT THE BOTTOM
I don't know why this is so. I have no problem with login. However, I am having a problem with the registration part. I did some research on modal but couldn't solve the problem
Error:
register modal
<div class="modal fade" id="modal--register-kayit" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-contentt">
<!-- <div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> -->
<body class="login">
<section class="login">
<div class="container-login">
<div class="form-login">
<button type="button" class="btn-closee" data-bs-dismiss="modal" aria-label="Close"></button>
<h2 class="login" >
<a href="{{ url('/') }}" style="text-decoration:none; margin-left: 50px;">
{{ $site_name }}
</a>
</h2>
<form class="form-login" action="{{ route('register) }}" method="post">
{{ csrf_field() }}
<div>
<div class="inputBx">
<input id="name" type="text" class="login #error('name') is-invalid #enderror" name="name" value="{{ old('name') }}" required autocomplete="name">
<span class="login">{{ __('Kullanıcı Adı') }}</span>
#if($errors->has('name'))
<script>
$(document).ready(function() {
$('#modal--register--kayit').modal('show');
});
</script>
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
<i class="fas fa-user-circle"></i>
</div>
<div class="inputBx">
<input id="email" type="email" class="login #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
<span class="login">{{ __('Email') }}</span>
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<i class="fas fa-envelope"></i>
</div>
<div class="inputBx password">
<input id="password" type="password" class="login #error('password') is-invalid #enderror" name="password" required autocomplete="current-password">
<i class="fas fa-key"></i>
<span class="login">Şifre</span>
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
<div class="inputBx password">
<input id="password-confirm" type="password" class="login" name="password_confirmation" required autocomplete="off">
<i class="fas fa-key"></i>
<span class="login">{{ __('auth.confirm_password') }}</span>
</div>
<form action="#" onsubmit="
if(document.getElementById('agree').checked) {
return true;
} else {
alert('Lütfen Şartlar ile Gizlilik Politikasını okuyup kabul ettiğinizi belirtin.'); return false; }">
<input class="login" type="checkbox" required name="checkbox" value="check" id="agree" /> Okudum ve onaylıyorum <br> Şartlar ve Politikalar
</form>
<!--
<div class="mb-3">
<label class="form-check">
<input type="checkbox" class="form-check-input">
<span class="form-check-label">Agree the .</span>
</label>
</div>
-->
{!! NoCaptcha::display() !!}
<span class="" role="alert">
<strong style="color: red;">#error('g-recaptcha-response') {{ $message}} #enderror</strong>
</span>
<div class="inputBx">
<input type="submit" value="{{ __('Yeni Hesap Oluştur') }}" class="login" style="max-width: 180px;">
</div>
</form>
#if (Route::has('password.request'))
<p class="login">Şifreni mi Unuttun?
<a class="login" href="{{ route('password.request') }}">
Sıfırlamak için tıkla!
</a>
</p>
#endif
<p class="login">Henüz bir hesabınız yok mu? <a class="login" href="{{ url('register') }}">Kayıt Ol</a></p>
</div>
</div>
</section>
</body>
</div>
</div>
</div>
Where I call Modal
<a href="#" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modal--register--kayit">
{{ __('auth.register') }}
</a>
SEAMLESS ENTRY MODAL
<div class="modal fade" id="modal--login--giris" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-contentt">
<!-- <div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> -->
<body class="login">
<section class="login">
<div class="container-login">
<div class="form-login">
<button type="button" class="btn-closee" data-bs-dismiss="modal" aria-label="Close"></button>
<h2 class="login" >
<a href="{{ url('/') }}" style="text-decoration:none; margin-left: 50px;">
{{ $site_name }}
</a>
</h2>
<form method="POST" action="{{ route('login') }}" class="form-login">
{{ csrf_field() }}
<div class="inputBx">
<input id="email" type="email" class="login #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
<span class="login">{{ __('Kullanıcı Adı') }}</span>
#error('email')
<script>
$(document).ready(function() {
$('#modal--login--giris').modal('show');
});
</script>
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<i class="fas fa-user-circle"></i>
</div>
<div class="inputBx password">
<input id="password" type="password" class="login #error('password') is-invalid #enderror" name="password" required autocomplete="current-password">
<p href="#" class="password-control login" onclick="return show_hide_password(this);"> </p>
<i class="fas fa-key"></i>
<span class="login">Şifre</span>
#error('password')
<script>
$(document).ready(function() {
$('#modal--login--giris').modal('show');
});
</script>
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
<label class="remember">
<input type="checkbox" class="login form-check-input remember" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}> {{ __('Beni Hatırla') }}
</label>
{!! NoCaptcha::display() !!}
#error('g-recaptcha-response')
<script>
$(document).ready(function() {
$('#modal--login--giris').modal('show');
});
</script>
<span class="" role="alert">
<strong style="color: red;">Lütfen Robot Olmadığınızı Kanıtlayın.</strong>
</span>
#enderror
<div class="inputBx">
<!-- <button type="submit" name="submit" value="Log in">{{ __('Giriş Yap') }}</button>-->
<input type="submit" value="{{ __('Giriş Yap') }}" class="login">
</div>
</form>
#if (Route::has('password.request'))
<p class="login">Şifreni mi Unuttun?
<a class="login" href="{{ route('password.request') }}">
Sıfırlamak için tıkla!
</a>
</p>
#endif
<p class="login">Henüz bir hesabınız yok mu? Kayıt Ol</p>
</div>
</div>
</section>
</body>
</div>
</div>
</div>

why the css style did not working ? ( Laravel )

I want to ask something because I don't quite understand the file.
I want to create a Login/Register for a User and I found a tutorial to create the login and register I want.
Here tutorial website link : https://medium.com/geekculture/customize-the-login-and-register-page-for-user-admin-in-laravel-v8-9e42127d0185
and also github complete file : https://github.com/sgwebfreelancer/laravel_auth_tutorial
In the tutorial has provided a complete file with login/register for User and also Admin Panel.
But there are some problems where the css file does not seem to work and the login and register design becomes empty. It should have like a picture. Below me as well as how login and register should be:
in this tutorial it should be like this :
So how to solved this problem ? it is have any problem with css or app.blade.php file ?
login.blade.php
#extends('layouts.app')
#section('content')
<div class="container-scroller">
<div class="container-fluid page-body-wrapper full-page-wrapper">
<div class="content-wrapper d-flex align-items-center auth auth-bg-1 theme-one">
<div class="row w-100">
<div class="col-lg-4 mx-auto">
<div class="auto-form-wrapper">
<form method="POST" action="{{ route('login') }}">
#csrf
<div class="form-group">
<label class="label">Email</label>
<div class="input-group">
<input id="email" type="email"
class="form-control #error('email') is-invalid #enderror" name="email"
value="{{ old('email') }}" required autocomplete="email" autofocus>
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group">
<label class="label">Password</label>
<div class="input-group">
<input id="password" type="password"
class="form-control #error('password') is-invalid #enderror" name="password"
required autocomplete="current-password">
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary submit-btn btn-block">
{{ __('Login') }}
</button>
</div>
<div class="form-group d-flex justify-content-between">
<div class="form-check form-check-flat mt-0">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember" id="remember"
{{ old('remember') ? 'checked' : '' }}> Keep me signed in
</label>
</div>
#if (Route::has('password.request'))
<a class="text-small forgot-password text-black"
href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
#endif
</div>
<div class="text-block text-center my-3">
<span class="text-small font-weight-semibold">Not a member ?</span>
Create new account
</div>
</form>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->
#endsection
register.blade.php
#extends('layouts.app')
#section('content')
<div class="container-scroller">
<div class="container-fluid page-body-wrapper full-page-wrapper">
<div class="content-wrapper d-flex align-items-center auth register-bg-1 theme-one">
<div class="row w-100">
<div class="col-lg-4 mx-auto">
<h2 class="text-center mb-4">{{ __('Register') }}</h2>
<div class="auto-form-wrapper">
<form method="POST" action="{{ route('register') }}">
#csrf
<div class="form-group">
<div class="input-group">
<input id="name" type="text"
class="form-control #error('name') is-invalid #enderror" name="name"
value="{{ old('name') }}" required autocomplete="name" autofocus
placeholder="Name">
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
#error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group">
<div class="input-group">
<input id="email" type="email"
class="form-control #error('email') is-invalid #enderror" name="email"
value="{{ old('email') }}" required autocomplete="email" placeholder="Email">
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group">
<div class="input-group">
<input id="password" type="password"
class="form-control #error('password') is-invalid #enderror" name="password"
required autocomplete="new-password" placeholder="**********">
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group">
<div class="input-group">
<input id="password-confirm" type="password" class="form-control"
name="password_confirmation" required autocomplete="new-password"
placeholder="**********">
<div class="input-group-append">
<span class="input-group-text">
<i class="mdi mdi-check-circle-outline"></i>
</span>
</div>
</div>
</div>
<div class="form-group d-flex justify-content-center">
<div class="form-check form-check-flat mt-0">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" checked> I agree to the terms
</label>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary submit-btn btn-block">
{{ __('Register') }}
</button>
</div>
<div class="text-block text-center my-3">
<span class="text-small font-weight-semibold">Already have and account ?</span>
{{ __('Login') }}
</div>
</form>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->
#endsection
css file asset/css/demo_1/style.css you guys see from here
https://github.com/sgwebfreelancer/laravel_auth_tutorial/blob/main/public/assets/css/demo_1/style.css
layouts/app.blade.php file you guys can see from here
https://github.com/sgwebfreelancer/laravel_auth_tutorial/blob/main/resources/views/layouts/app.blade.php
in my console, i saw my css not load it.
In layouts.app, line 15, you have to change :
href="{{ asset('public/assets/css/shared/style.css')
to
href="{{ asset('/assets/css/shared/style.css')

laravel Error 419 PAGE EXPIRED Sorry, your session has expired. Please refresh and try again

I have tried to try login into my system. but I got always the same error. The full website is run goods but when I try to login then shows the problem "Error 419 PAGE EXPIRED Sorry, your session has expired. Please refresh and try again". my website link is https://atozwp.xyz
My login form Code is here-
<form class="ui large form" action="{{ route('login', ['redirect' => request()->redirect ?? '/']) }}" method="post">
#csrf
<div class="field">
<label>Email</label>
<input type="email" placeholder="..." name="email" value="{{ old('email', session('email')) }}" required autocomplete="email" autofocus>
#error('email')
<div class="ui negative message">
<strong>{{ $message }}</strong>
</div>
#enderror
</div>
<div class="field">
<label>{{ __('Password') }}</label>
<input type="password" placeholder="..." name="password" required autocomplete="current-password">
#error('password')
<div class="ui negative message">
<strong>{{ $message }}</strong>
</div>
#enderror
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="remember" id="remember">
<label class="checkbox" for="remember">{{ __('Remember me') }}</label>
</div>
</div>
#error('captcha')
<div class="ui negative message">
<strong>{{ $message }}</strong>
</div>
#enderror
#error('g-recaptcha-response')
<div class="ui negative message">
<strong>{{ $message }}</strong>
</div>
#enderror
#if(captcha_is_enabled('login'))
<div class="field d-flex justify-content-center">
{!! render_captcha() !!}
#if(captcha_is('mewebstudio'))
<input type="text" name="captcha" value="{{ old('captcha') }}" class="ml-1">
#endif
</div>
#endif
<div class="field mb-0">
<button class="ui yellow large fluid circular button" type="submit">{{ __('Login') }}</button>
</div>
<div class="field">
<div class="ui text menu my-0">
<a class="item right aligned" href="{{ route('password.request') }}">{{ __('Forgot password') }}</a>
</div>
</div>
</form>

The page has expired due to inactivity issue in laravel

I have got the issue in Laravel of The page has expired due to inactivity.
Please refresh and try again. I have also check {{ csrf_field() }} and its is fine but issue is still there. I have also checked about try cache, view, route clear command but again bad luck. Can any one suggest me what is the issue.
Form Code :
<form id="loginform" class="form-vertical" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="control-group normal_text"> <h3><img src="{{ asset('img/logo.png') }}" alt="Logo" /></h3></div>
<div class="control-group">
<div class="controls">
<div class="main_input_box">
<span class="add-on bg_lg"><i class="icon-user"> </i></span>
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus placeholder="Username"/>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="main_input_box">
<span class="add-on bg_ly"><i class="icon-lock"></i></span>
<input id="password" type="password" class="form-control" name="password" required placeholder="Password" />
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
</div>
<div class="form-actions">
<span class="pull-left">Lost password?</span>
<span class="pull-right"><button type="submit" class="btn btn-success">Login</button></span>
</div>
</form>
I have solved.
I have tried all steps from https://www.5balloons.info/fixed-page-expired-due-inactivity-laravel-5/ but the issue is still on there.
The main issue was my browser catch setting.
see below screenshot for more idea.

login auth didn't work onlie in laravel

I'm trying to make login and register at my laravel website , and i have been used the laravel make auth , it's working very good at local host but when i have uploaded it it's not . It doesn't read the auth name or anything just it's regsiter new user but can't login or show the error message or anything.
please i need help ? and here's my register blade
#extends('layouts.app')
#section('content')
<!-- Modal Signup -->
<div class="modal fade style-base-modal" id="modal-signup" tabindex="-1" role="dialog" aria-hidden="true" aria-labelledby="modalSignupLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="inner-container clearfix">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">
<i class="fa fa-times"></i>
</span>
</button>
<h4 class="modal-title email-icon" id="modalSignupLabel">#lang('messages.Create-your-Account')</h4>
</div>
<div class="modal-body clearfix">
<div class="col-md-7 no-padding">
<form accept-charset="UTF-8" class="form-style-base" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group no-bottom-border no-padding form-group-style-sign {{ $errors->has('name') ? ' has-error' : '' }}">
<input type="text" class="form-control input-lg form-control-style-sign" placeholder="#lang('messages.UserName')" name="name" value="{{ old('name') }}"/>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
<div class="form-group no-bottom-border no-padding form-group-style-sign {{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" class="form-control input-lg form-control-style-sign" placeholder="#lang('messages.Email')" name="email" value="{{ old('email') }}" />
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
<div class="form-group no-bottom-border no-padding form-group-style-sign {{ $errors->has('password') ? ' has-error' : '' }}">
<input type="password" class="form-control input-lg form-control-style-sign" placeholder="#lang('messages.Password')" name="password">
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
<div class="form-group no-bottom-border no-padding form-group-style-sign {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<input type="password" class="form-control input-lg form-control-style-sign" placeholder="#lang('messages.Re-password')" name="password_confirmation">
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
<div class="required-fields text-right spacer-bottom-5">
*#lang('messages.Required-fields')
</div>
<div>
<!-- <div class="checkbox">
<label class="btn-link small">
<input type="checkbox" name="Iscriviti" value="1" /> Subscribe to the newsletter
</label>
</div>-->
<!-- <div class="checkbox">
<label class="btn-link small">
<input type="checkbox" name="privacy" value="1" /> I agree to the policies of the <a class="btn-link" href="#">privacy</a>
</label>
</div> -->
</div>
<div>
<button type="submit" class="btn btn-warning btn-lg btn-block">
<i class="fa fa-user"></i> #lang('messages.create-account')
</button>
</div>
<!--<p class="text-center small no-margin">
<label class="member-label">Already are you member? </label><a class="btn-link" href="signin.html">Sign in</a>
</p>-->
</form> </div>
<div class="col-md-5 spacer-30">
<div class="text-center">
<h4 class="no-margin-top social-sign">
#lang('messages.socialnetwork')<br>#lang('messages.accountSignin')
</h4>
<div class="socials btn-group clearfix">
<a class="btn-social btn-facebook " href="redirect"> <i class="fa fa-facebook fa-1x"></i> </a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end sign up -->
#endsection
Do you see any error message on storage/logs/laravel.log file?

Categories