Show inoperative Request pwd form in Demo

This commit is contained in:
Bubka 2020-10-12 14:00:09 +02:00
parent 6b0d605d01
commit 4303af509f
6 changed files with 32 additions and 3 deletions

View File

@ -63,6 +63,7 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'AvoidResetPassword' => \App\Http\Middleware\AvoidPasswordResetInDemo::class,
];
/**

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
class AvoidPasswordResetInDemo
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if( config('app.options.isDemoApp') ) {
return response()->json(['requestFailed' => __('auth.forms.no_reset_password_in_demo')], Response::HTTP_UNAUTHORIZED);
}
return $next($request);
}
}

View File

@ -7,7 +7,7 @@
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.sign_in')" />
</form>
<p>{{ $t('auth.forms.dont_have_account_yet') }}&nbsp;<router-link :to="{ name: 'register' }" class="is-link">{{ $t('auth.register') }}</router-link></p>
<p v-if="!$root.appSettings.isDemoApp">{{ $t('auth.forms.forgot_your_password') }}&nbsp;<router-link :to="{ name: 'password.request' }" class="is-link">{{ $t('auth.forms.request_password_reset') }}</router-link></p>
<p>{{ $t('auth.forms.forgot_your_password') }}&nbsp;<router-link :to="{ name: 'password.request' }" class="is-link">{{ $t('auth.forms.request_password_reset') }}</router-link></p>
</form-wrapper>
</template>
@ -44,7 +44,7 @@
this.$notify({ type: 'is-danger', text: this.$t('auth.forms.password_do_not_match'), duration:-1 })
}
else if( error.response.status !== 422 ) {
this.$router.push({ name: 'genericError', params: { err: error.response } });
}
});

View File

@ -35,6 +35,7 @@
'forgot_your_password' => 'Forgot your password?',
'request_password_reset' => 'Request a password reset',
'reset_password' => 'Reset password',
'no_reset_password_in_demo' => 'No reset in Demo mode',
'new_password' => 'New password',
'current_password' => [
'label' => 'Current password',

View File

@ -35,6 +35,7 @@
'forgot_your_password' => 'Mot de passe oublié ?',
'request_password_reset' => 'Réinitialiser le mot de passe',
'reset_password' => 'Mot de passe oublié',
'no_reset_password_in_demo' => 'Réinitialisation impossible en mode Démo',
'new_password' => 'Nouveau mot de passe',
'current_password' => [
'label' => 'Mot de passe actuel',

View File

@ -19,7 +19,7 @@
Route::post('checkuser', 'Auth\RegisterController@checkUser');
Route::post('register', 'Auth\RegisterController@register');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->middleware('AvoidResetPassword');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.reset');
});