Working on multi-language support

This commit is contained in:
Hillel Coren 2014-04-02 21:20:01 +03:00
parent c53528f997
commit 1b7c885367
10 changed files with 102 additions and 46 deletions

View File

@ -26,9 +26,9 @@ class UserController extends BaseController {
$user->force_pdfjs = true; $user->force_pdfjs = true;
$user->save(); $user->save();
Session::flash('message', 'Successfully updated PDF settings'); Session::flash('message', trans('texts.confide.updated_settings'));
return Redirect::to('/invoices/create'); return Redirect::to('/dashboard');
} }
/** /**
@ -86,6 +86,7 @@ class UserController extends BaseController {
if( Confide::user() ) if( Confide::user() )
{ {
Event::fire('user.login'); Event::fire('user.login');
Session::reflash();
$invoice = Invoice::scope()->orderBy('id', 'desc')->first(); $invoice = Invoice::scope()->orderBy('id', 'desc')->first();
@ -95,7 +96,7 @@ class UserController extends BaseController {
} }
else else
{ {
return Redirect::to('/invoices/create'); return Redirect::to('/dashboard');
} }
} }
else else
@ -137,7 +138,7 @@ class UserController extends BaseController {
// Check if there was too many login attempts // Check if there was too many login attempts
if( Confide::isThrottled( $input ) ) if( Confide::isThrottled( $input ) )
{ {
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts'); $err_msg = trans('texts.confide.too_many_attempts');
} }
/* /*
elseif( $user->checkUserExists( $input ) and ! $user->isConfirmed( $input ) ) elseif( $user->checkUserExists( $input ) and ! $user->isConfirmed( $input ) )
@ -147,7 +148,7 @@ class UserController extends BaseController {
*/ */
else else
{ {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials'); $err_msg = trans('texts.confide.wrong_credentials');
} }
return Redirect::action('UserController@login') return Redirect::action('UserController@login')
@ -165,15 +166,13 @@ class UserController extends BaseController {
{ {
if ( Confide::confirm( $code ) ) if ( Confide::confirm( $code ) )
{ {
$notice_msg = Lang::get('confide::confide.alerts.confirmation'); $notice_msg = trans('texts.confide.confirmation');
return Redirect::action('UserController@login') return Redirect::action('UserController@login')->with( 'message', $notice_msg );
->with( 'notice', $notice_msg );
} }
else else
{ {
$error_msg = Lang::get('confide::confide.alerts.wrong_confirmation'); $error_msg = trans('texts.confide.wrong_confirmation');
return Redirect::action('UserController@login') return Redirect::action('UserController@login')->with( 'error', $error_msg );
->with( 'error', $error_msg );
} }
} }
@ -194,7 +193,7 @@ class UserController extends BaseController {
{ {
Confide::forgotPassword( Input::get( 'email' ) ); Confide::forgotPassword( Input::get( 'email' ) );
$notice_msg = Lang::get('confide::confide.alerts.password_forgot'); $notice_msg = trans('texts.confide.password_forgot');
return Redirect::action('UserController@login') return Redirect::action('UserController@login')
->with( 'notice', $notice_msg ); ->with( 'notice', $notice_msg );
@ -241,13 +240,13 @@ class UserController extends BaseController {
// By passing an array with the token, password and confirmation // By passing an array with the token, password and confirmation
if( Confide::resetPassword( $input ) ) if( Confide::resetPassword( $input ) )
{ {
$notice_msg = Lang::get('confide::confide.alerts.password_reset'); $notice_msg = trans('texts.confide.password_reset');
return Redirect::action('UserController@login') return Redirect::action('UserController@login')
->with( 'notice', $notice_msg ); ->with( 'notice', $notice_msg );
} }
else else
{ {
$error_msg = Lang::get('confide::confide.alerts.wrong_password_reset'); $error_msg = trans('texts.confide.wrong_password_reset');
return Redirect::action('UserController@reset_password', array('token'=>$input['token'])) return Redirect::action('UserController@reset_password', array('token'=>$input['token']))
->withInput() ->withInput()
->with( 'error', $error_msg ); ->with( 'error', $error_msg );

View File

@ -277,5 +277,15 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -277,6 +277,16 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -276,5 +276,16 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -277,5 +277,16 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -277,6 +277,17 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -276,5 +276,16 @@ return array(
'expiration_year' => 'Expiration year', 'expiration_year' => 'Expiration year',
'cvv' => 'CVV', 'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
); );

View File

@ -1,9 +1,9 @@
<h1>{{ trans('texts.confirmation_header') }}</h1> <h1>{{ trans('texts.confirmation_header') }}</h1>
<p>{{ trans('texts.confirmation_message') }}</p> {{ trans('texts.confirmation_message') }}<p/>
<a href='{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}'> <a href='{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}'>
{{{ URL::to("user/confirm/{$user->confirmation_code}") }}} {{{ URL::to("user/confirm/{$user->confirmation_code}") }}}
</a> </a><p/>
{{ trans('texts.email_signature') }}<br/> {{ trans('texts.email_signature') }}<br/>
{{ trans('texts.email_from') }} {{ trans('texts.email_from') }}

View File

@ -172,14 +172,6 @@
</li> </li>
</ul> </ul>
</div><!-- /.navbar-collapse --> </div><!-- /.navbar-collapse -->
</div> </div>
</nav> </nav>

View File

@ -475,9 +475,10 @@ function wordWrapText(value, width)
if (numLines <= 1) continue; if (numLines <= 1) continue;
var j = 0; space = lines[i].length; var j = 0; space = lines[i].length;
while (j++ < lines[i].length) { while (j++ < lines[i].length) {
if (lines[i].charAt(j) === " ") space = j; if (lines[i].charAt(j) === ' ') space = j;
} }
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || ""); if (space == lines[i].length) space = width/6;
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || '');
lines[i] = lines[i].substring(0, space); lines[i] = lines[i].substring(0, space);
} }