Page 1 of 1

FEU - convert password after input

Posted: Mon Feb 27, 2017 11:24 am
by chips
Hi. I'm running CMS Made Simple 2.1.6. PHP version is 5.5.38 I am running FrontEndUsers 2.3.2 / CGExtension v1.53.18 / CGSimpleSmarty v2.1.6

In FEU, using FEU Standard Authentication, is it possible to convert the password that is entered by a user during login to all lower case for example after the form is submitted and before it is checked against the database? We need to do this for one particular generic user account. Is it possible to add this code within the "FrontEndUser::Login Form" template?

Also in FEU, where do we see all possible values of $error? We want to change the message that is being displayed by evaluating the value of $error.

Thanks for any input.

Re: FEU - convert password after input

Posted: Mon Feb 27, 2017 3:28 pm
by velden
I think the way to go would be a javascript solution which, onSubmit, changes the password. This shouldn't be to hard but it exposes your method to the www

Re: FEU - convert password after input

Posted: Sat Mar 04, 2017 7:18 am
by chips
Hi velden,

Thanks for the reply. I have tried as you suggested and have been consuming the past couple of days in searching for answers and sample code. When I place an Onclick on the button and point it to a javascript that will process the value of {$fldname_password}.value as needed, nothing happens.

Code: Select all

      
<button class="btn btn-active" name="{$actionid}feu_submit"  onClick="convString()">{$FrontEndUsers->Lang('login')}</button>
the function is this:

Code: Select all

<__script__ language="JavaScript">

function convString()
{
       {$fldname_password}.value = .... do conversion here ....
       return true;
}
I am already at a lost on what to do next. Appreciate any help as I am not a developer. Thanks.

Re: FEU - convert password after input

Posted: Sat Mar 04, 2017 11:21 am
by Rolf

Re: FEU - convert password after input

Posted: Sat Mar 04, 2017 1:06 pm
by velden
Try (assumig 'feu_password' is the ID of the field):

Code: Select all

function convString()
{
       p = document.getElementById('feu_password');
       p.value = p.value.toLowerCase();
       return true;
}

Re: FEU - convert password after input

Posted: Sat Mar 04, 2017 3:53 pm
by chips
Rolf, thanks very much for the link. The use of onkeyup as well as 'this' is a new learning for me and could be used in future for other forms that I create. Aside from converting to lowercase, I need to make some further processing of the password and the solution by Velden did it. I will make sure to study the getElementById.

Velden, thanks very much for the solution.