Added success message when you change credentials

Added "see password" button - With CSS & Script (Script in file)
This commit is contained in:
Anders 2020-07-31 09:28:58 +02:00
parent 38f8bfa0c9
commit 56cbe7ad41
5 changed files with 35 additions and 6 deletions

View File

@ -152,6 +152,8 @@ class UserController extends Controller
}
} else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user.
$user->update($data);
return redirect()->route("users.account")->with('success#credentialschanged', '<p class="text-center">Dine oplysninger er hermed ændret!</p>');
}
}

View File

@ -341,7 +341,6 @@ a {
.links {
position: absolute;
align-self: center;
width: 100%;
bottom: 8px;
height: 2rem;
@ -6944,3 +6943,9 @@ main {
display: inline-block;
}
.spaneye {
position: absolute;
font-size: 25px;
color: grey;
margin: 7.5px 0 0 -45px;
}

View File

@ -10,6 +10,7 @@
<h4 class="mt-0">Navn: {{ Auth::user()->name_first . " " . Auth::user()->name_last }}</h4>
<h4 class="mt-0">Email: {{ Auth::user()->email }}</h4>
<h4 class="mt-0">Telefon Nr.: {{ Auth::user()->phone }}</h4>
{!! session()->get('success#credentialschanged') !!}
<a class="btn text-center btn-sde-blue mt-1" href="{{ route("users.accountedit") }}">Rediger Oplysninger</a>
<a class="btn text-center btn-sde-blue mt-1" href="{{ route("users.accounteditpass") }}">Ændre Password</a>
</main>

View File

@ -11,12 +11,13 @@
@csrf
@method("put")
<span>Navn:</span>
<input type="text" name="name" id="name" value="{{ Auth::user()->name_first . " " . Auth::user()->name_last }}" disabled>
<input type="text" value="{{ Auth::user()->name_first . " " . Auth::user()->name_last }}" disabled>
<span>Email:</span>
<input type="email" name="email" id="email" value="{{ Auth::user()->email }}" required>
<span>Telefon Nr.:</span>
<input type="text" name="phone" id="phone" value="{{ Auth::user()->phone }}" required>
<button type="submit" class="btn text-center btn-sde-blue mt-1">Rediger</button>
<a href="{{ route('users.account') }}" class="btn text-center btn-sde-blue mt-1">Tilbage</a>
</form>
</main>
@endsection

View File

@ -7,18 +7,38 @@
@section("content")
<main>
<h1 class="text-center sde-blue mt-0">Konto</h1>
<form method="post" action="{{ route("users.update", ['user' => Auth::user()]) }}">
<form method="post" action="{{ route("users.update", ['user' => Auth::user()]) }}" style="display: block;">
@csrf
@method("put")
<span>Nuværende Password:</span>
<input type="password" name="oldpassword" id="old" required>
<input type="password" name="oldpassword" id="old" placeholder="******" required style="width: calc(100% - 12px)">
<span toggle="#password-field" class="fa fa-fw fa-eye field-icon toggle-password spaneye" id="fa-old" onclick="show('old', 'fa-old')"></span>
<span>Nyt Password:</span>
<input type="password" name="password" id="new" required>
<input class="w-100" type="password" name="password" id="new" placeholder="******" required style="width: calc(100% - 12px)">
<span toggle="#password-field" class="fa fa-fw fa-eye field-icon toggle-password spaneye" id="fa-new" onclick="show('new', 'fa-new')"></span>
<span>Bekræft Nyt Password:</span>
<input type="password" name="confirmpassword" id="confirm" required>
<input class="w-100" type="password" name="confirmpassword" id="confirm" placeholder="******" required style="width: calc(100% - 12px)">
<span toggle="#password-field" class="fa fa-fw fa-eye field-icon toggle-password spaneye" id="fa-confirm" onclick="show('confirm', 'fa-confirm')"></span>
{!! session()->get('error#notsamepass') !!}
{!! session()->get('error#oldpass') !!}
<button type="submit" class="btn text-center btn-sde-blue mt-1">Rediger</button>
</form>
</main>
@endsection
@section("scripts")
<script>
function show($passID, $faID) {
var inputPass = document.getElementById($passID);
var faEye = document.getElementById($faID);
if (inputPass.type === "password") {
inputPass.type = "text";
faEye.style.color = "#000";
} else {
inputPass.type = "password";
faEye.style.color = "#808080";
}
}
</script>
@endsection