Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only change the lock code every few rides. #119

Open
ewooonk opened this issue Sep 4, 2017 · 1 comment
Open

Only change the lock code every few rides. #119

ewooonk opened this issue Sep 4, 2017 · 1 comment
Assignees

Comments

@ewooonk
Copy link

ewooonk commented Sep 4, 2017

Although this turned out to be not practical in our case, it might be helpful for others.

   $codereset=sprintf("%04d",rand(1,4));
   if ($codereset == 3)
   {
       { $newCode = sprintf("%04d",rand(100,9900));
       }
   }
   if ($codereset != 3)
   {
       { $newCode=$currentCode;
       }
       
   }
   // do not create a code with more than one leading zero or more than two leading 9s (kind of unusual/unsafe).
   if ($force==FALSE)
      {
      if ($currentUser==$userId)
         {
         response(_('You already rented bike')." ".$bikeNum.". "._('Code is')." ".$currentCode.".",ERROR);
         return;
         }
      if ($currentUser!=0)
         {
         response(_('Bike')." ".$bikeNum." "._('is already rented').".",ERROR);
         return;
         }
      }
   if ($codereset == 3)
   {
       { $message='<h3>'._('Bike').' '.$bikeNum.': <span class="label label-primary">'._('Open with code').' '.$currentCode.'.</span></h3>'._('Change code immediately to').' <span class="label label-default">'.$newCode.'</span><br />'._('(open, move pin on the bottom to position B, set new code, move pin back to position A)').'.';
       }
   }
   if ($codereset != 3)
   {
       { $message='<h3>'._('Bike').' '.$bikeNum.': <span class="label label-primary">'._('Open with code').' '.$currentCode.'.</span></h3>'._('You do not need to change the code').' .';
       }
   }
@ewooonk ewooonk changed the title Only change the lock code every few rides. new feature Only change the lock code every few rides. Sep 4, 2017
@nekromoff
Copy link
Collaborator

Thanks.

Please, @jozefbalun add this as a config option to the new Laravel version as well as implement it accordingly (or assign to @miroc).

Reasoning: some systems may want to change the code only from time to time, e.g. every 10th ride or such.

@sveneld sveneld removed the laravel label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants