Skip to content

Commit

Permalink
increase email code length to 6
Browse files Browse the repository at this point in the history
displays a hyphen in the code to separate into groups of 3, but the hyphen is not required to be entered

for #39
  • Loading branch information
aaronpk committed Jul 22, 2019
1 parent b708446 commit c58f897
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Provider/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function verify_email_code(ServerRequestInterface $request, ResponseInter

// Check that the code they entered matches the code that was stored

if(strtolower($usercode) == strtolower($params['usercode'])) {
if(strtolower(str_replace('-','',$usercode)) == strtolower(str_replace('-','',$params['usercode']))) {
return $this->_finishAuthenticate($response);
} else {
$k = 'indielogin:email:usercode:attempts:'.$params['code'];
Expand Down
3 changes: 2 additions & 1 deletion lib/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ function random_string() {
function random_user_code() {
$charset = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
$code = '';
for($i = 0; $i < 4; $i++) {
for($i = 0; $i < 6; $i++) {
$code .= substr($charset, random_int(0, strlen($charset)-1), 1);
}
$code = substr($code, 0, 3).'-'.substr($code, 3);
return $code;
}

Expand Down
2 changes: 1 addition & 1 deletion views/auth/email-enter-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<input type="hidden" id="code" name="code" value="<?= $code ?>">

<div class="form-group">
<input type="text" id="usercode" name="usercode" class="form-control" autocomplete="off" maxlength="6">
<input type="text" id="usercode" name="usercode" class="form-control" autocomplete="off" maxlength="7">
</div>

<input type="submit" id="verify-code" value="Verify Code" class="btn btn-primary">
Expand Down

0 comments on commit c58f897

Please sign in to comment.