Skip to content

Commit

Permalink
Merge pull request #1293 from shivendra-webkul/krayin-update
Browse files Browse the repository at this point in the history
Updated Login, Forget password, Reset Password Pages
  • Loading branch information
jitendra-webkul authored Jul 24, 2024
2 parents 3491f26 + 2ca2f59 commit 63d8670
Show file tree
Hide file tree
Showing 9 changed files with 363 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Notifications\User\UserResetPassword;

Expand All @@ -13,10 +14,8 @@ class ForgotPasswordController extends Controller

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\View\View
*/
public function create()
public function create(): View
{
if (auth()->guard('user')->check()) {
return redirect()->route('admin.dashboard.index');
Expand Down
21 changes: 0 additions & 21 deletions packages/Webkul/Admin/src/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@
Route::get('create/{id}', 'Webkul\Admin\Http\Controllers\DataGrid\SavedFilterController@create')->name('admin.datagrid.saved_filters.destroy');

Route::prefix(config('app.admin_path'))->group(function () {

Route::get('/', 'Webkul\Admin\Http\Controllers\Controller@redirectToLogin');

// Login Routes
Route::get('login', 'Webkul\Admin\Http\Controllers\User\SessionController@create')->name('admin.session.create');

//login post route to admin auth controller
Route::post('login', 'Webkul\Admin\Http\Controllers\User\SessionController@store')->name('admin.session.store');

// Forget Password Routes
Route::get('forgot-password', 'Webkul\Admin\Http\Controllers\User\ForgotPasswordController@create')->name('admin.forgot_password.create');

Route::post('forgot-password', 'Webkul\Admin\Http\Controllers\User\ForgotPasswordController@store')->name('admin.forgot_password.store');

// Reset Password Routes
Route::get('reset-password/{token}', 'Webkul\Admin\Http\Controllers\User\ResetPasswordController@create')->name('admin.reset_password.create');

Route::post('reset-password', 'Webkul\Admin\Http\Controllers\User\ResetPasswordController@store')->name('admin.reset_password.store');

Route::post('mail/inbound-parse', 'Webkul\Admin\Http\Controllers\Mail\EmailController@inboundParse')->name('admin.mail.inbound_parse');

// Admin Routes
Route::group(['middleware' => ['user']], function () {
Route::delete('logout', 'Webkul\Admin\Http\Controllers\User\SessionController@destroy')->name('admin.session.destroy');
Expand Down
31 changes: 31 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
<?php

return [
'users' => [
'login' => [
'email' => 'Email Address',
'forget-password-link' => 'Forget Password ?',
'password' => 'Password',
'submit-btn' => 'Sign In',
'title' => 'Sign In',
],

'forget-password' => [
'create' => [
'email' => 'Registered Email',
'email-not-exist' => 'Email Not Exists',
'page-title' => 'Forget Password',
'reset-link-sent' => 'Reset Password link sent',
'sign-in-link' => 'Back to Sign In ?',
'submit-btn' => 'Reset',
'title' => 'Recover Password',
],
],

'reset-password' => [
'back-link-title' => 'Back to Sign In ?',
'confirm-password' => 'Confirm Password',
'email' => 'Registered Email',
'password' => 'Password',
'submit-btn' => 'Reset Password',
'title' => 'Reset Password',
],
],

'components' => [
'datagrid' => [
'index' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>

<html
lang="{{ app()->getLocale() }}"
dir="{{ core()->getCurrentLocale()->direction }}"
{{-- lang="{{ app()->getLocale() }}" --}}
{{-- dir="{{ core()->getCurrentLocale()->direction }}" --}}
>

<head>
Expand All @@ -16,7 +16,7 @@
>
<meta
http-equiv="content-language"
content="{{ app()->getLocale() }}"
{{-- content="{{ app()->getLocale() }}" --}}
>

<meta
Expand All @@ -29,7 +29,7 @@
>
<meta
name="currency-code"
content="{{ core()->getCurrentCurrencyCode() }}"
{{-- content="{{ core()->getCurrentCurrencyCode() }}" --}}
>

@stack('meta')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,74 @@
@extends('admin::layouts.anonymous-master')
<x-admin::layouts.anonymous>
<!-- Page Title -->
<x-slot:title>
@lang('admin::app.users.forget-password.create.page-title')
</x-slot>

@section('page_title')
{{ __('admin::app.sessions.forgot-password.title') }}
@stop
<div class="flex h-[100vh] items-center justify-center">
<div class="flex flex-col items-center gap-5">
<!-- Logo -->
@if ($logo = core()->getConfigData('general.design.admin_logo.logo_image'))
<img
class="h-10 w-[110px]"
src="{{ Storage::url($logo) }}"
alt="{{ config('app.name') }}"
/>
@else
<img
class="w-max"
src="{{ asset('vendor/webkul/admin/assets/images/logo.svg') }}"
alt="{{ config('app.name') }}"
/>
@endif

@section('content')
<div class="panel">
<div class="panel-body">
<div class="form-container">
<h1>{{ __('admin::app.sessions.forgot-password.title') }}</h1>

<form method="POST" action="{{ route('admin.forgot_password.store') }}" @submit.prevent="onSubmit">
{!! view_render_event('admin.sessions.forgot_password.form_controls.before') !!}

@csrf
<div class="box-shadow flex min-w-[300px] flex-col rounded-md bg-white dark:bg-gray-900">
<!-- Forget Password Form -->
<x-admin::form :action="route('admin.forgot_password.store')">
<div class="p-4">
<p class="text-xl font-bold text-gray-800 dark:text-white">
@lang('admin::app.users.forget-password.create.title')
</p>
</div>

<div class="form-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('admin::app.sessions.forgot-password.email') }}</label>
<div class="border-y p-4 dark:border-gray-800">
<!-- Registered Email -->
<x-admin::form.control-group>
<x-admin::form.control-group.label class="required">
@lang('admin::app.users.forget-password.create.email')
</x-admin::form.control-group.label>

<input
type="text"
name="email"
class="control"
id="email"
value="{{ old('email') }}"
v-validate="'required'"
data-vv-as="&quot;{{ __('admin::app.sessions.forgot-password.email') }}&quot;"
/>
<x-admin::form.control-group.control
type="email"
class="w-[254px] max-w-full"
id="email"
name="email"
rules="required|email"
:value="old('email')"
:label="trans('admin::app.users.forget-password.create.email')"
:placeholder="trans('admin::app.users.forget-password.create.email')"
/>

<span class="control-error" v-if="errors.has('email')">
@{{ errors.first('email') }}
</span>
<x-admin::form.control-group.error control-name="email" />
</x-admin::form.control-group>
</div>

<a href="{{ route('admin.session.create') }}">{{ __('admin::app.sessions.forgot-password.back-to-login') }}</a>
<div class="flex items-center justify-between p-4">
<!-- Back to Sign In link -->
<a
class="cursor-pointer text-xs font-semibold leading-6 text-blue-600"
href="{{ route('admin.session.create') }}"
>
@lang('admin::app.users.forget-password.create.sign-in-link')
</a>

{!! view_render_event('admin.sessions.forgot_password.form_controls.after') !!}

<div class="button-group">
{!! view_render_event('admin.sessions.forgot_password.form_buttons.before') !!}

<button class="btn btn-xl btn-primary">
{{ __('admin::app.sessions.forgot-password.send-reset-password-email') }}
<!-- Form Submit Button -->
<button
class="cursor-pointer rounded-md border border-blue-700 bg-blue-600 px-3.5 py-1.5 font-semibold text-gray-50">
@lang('admin::app.users.forget-password.create.submit-btn')
</button>

{!! view_render_event('admin.sessions.forgot_password.form_buttons.after') !!}
</div>
</form>
</x-admin::form>
</div>
</div>
</div>
@stop
</x-admin::layouts.anonymous>
Loading

0 comments on commit 63d8670

Please sign in to comment.