Manage Account

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Manage Account

Post by RonP » 2018-07-16 08:01

Hi,
Why can't you use an email address as username for the users that can login to the application?
This is always unique and, I think, much easier to remember than username and some weird suffix or abbreviated name.
I come to this because of the “Privacy Policy GDPR-Proof”. In our member administration we have to provide members with the opportunity to manage their account.
(Until now the admin made the changes).
So I have to populate the membership_users table and I thought it would be nice to have the email address as username
Ron

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-16 08:15

Continued......
As I see now, it is possible to use an email address, however the name field in the membership_users table is limited to 20 characters.
Most of the email addresses are much longer is it possible to set the length to more characters?
Ron

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Manage Account

Post by pböttcher » 2018-07-16 09:52

Hi,

you need to change your DB defintion to allow the amount of characters you want and you need to adjust the
admin/incFunctions.php file, search for the is_allowed_username function. (remember that it might be overwritten when you recreate your project).

function is_allowed_username($username, $exception = false){
$username = trim(strtolower($username));
if(!preg_match('/^[a-z0-9][a-z0-9 _.@]{3,19}$/', $username) || preg_match('/(@@| |\.\.|___)/', $username)) return false;

if($username == $exception) return $username;

if(sqlValue("select count(1) from membership_users where lcase(memberID)='{$username}'")) return false;
return $username;

Replace the 3,19 in the preg_match to whatever you want to allow. To increase to e.g. 40 put 3,40.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-17 12:22

Hi PBöttcher,
Thank you for the reply with the "tips" and coding.
I'm going to "test" implement this.

Ron

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-17 13:47

Hi,
I've got a slight difference coding, is that because I still working with Appgini Version 5.50 Revision 835?
Can I still your given change?

Code: Select all

########################################################################
	function is_allowed_username($username){
		$username = trim(strtolower($username));
		if(!preg_match('/^[a-z0-9][a-z0-9 _.@]{3,19}$/', $username) || preg_match('/(@@|  |\.\.|___)/', $username)) return false;
		if(sqlValue("select count(1) from membership_users where lcase(memberID)='{$username}'")) return false;
		return $username;
	}
Ron

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Manage Account

Post by pböttcher » 2018-07-17 15:11

sure, it should work the same way.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-17 15:18

I've been working on it and .... YES.
Thanks

Ron

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-20 16:26

Hi,
I was a bit to early .....
I didn't get errors after logging in however when I open one of the tables I get, per table, this kind of errors:
For views:
Warning: htmlspecialchars(): charset `Windows-1250' not supported, assuming utf-8 <projectname>/datalist.php on line 993
Warning: htmlspecialchars(): charset `Windows-1250' not supported, assuming utf-8 <projectname/datalist.php on line 1199
For <table name>_view.php:
Warning: htmlspecialchars(): charset `Windows-1250' not supported, assuming utf-8 <<projectname><tablename>_datalist.php on line 399

And for <table name>_view.php Detail
Warning: htmlspecialchars(): charset `Windows-1250' not supported, assuming utf-8 <<table name>_dml.php on line 399

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-20 16:30

Sorry,
Post wasn't finished yet :o
Could this all come because I've adjusted the length of column 'memberID' from 20 to 50?
Or is it because I work with Mysql 4.8.2 and PHP 6.6.36?

Ron

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Manage Account

Post by pböttcher » 2018-07-20 20:54

Hi,

I dont think this has to do with the length of the user.

It rather indicates that the char-set used is not supported. According to the doc for htmlspecialchars.


Supported charsets
Charset Aliases Description
ISO-8859-1 ISO8859-1 Western European, Latin-1.
ISO-8859-5 ISO8859-5 Little used cyrillic charset (Latin/Cyrillic).
ISO-8859-15 ISO8859-15 Western European, Latin-9. Adds the Euro sign, French and Finnish letters missing in Latin-1 (ISO-8859-1).
UTF-8 ASCII compatible multi-byte 8-bit Unicode.
cp866 ibm866, 866 DOS-specific Cyrillic charset.
cp1251 Windows-1251, win-1251, 1251 Windows-specific Cyrillic charset.
cp1252 Windows-1252, 1252 Windows specific charset for Western European.
KOI8-R koi8-ru, koi8r Russian.
BIG5 950 Traditional Chinese, mainly used in Taiwan.
GB2312 936 Simplified Chinese, national standard character set.
BIG5-HKSCS Big5 with Hong Kong extensions, Traditional Chinese.
Shift_JIS SJIS, SJIS-win, cp932, 932 Japanese
EUC-JP EUCJP, eucJP-win Japanese
MacRoman Charset that was used by Mac OS.

So if you setup your project with one of these char-sets it should be fine.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Manage Account

Post by RonP » 2018-07-21 13:24

Great,
Strange I didn’t change any "basic" settings, well it worked.
Thank you so much
Ron

Post Reply