Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 21st February 2012, 17:00
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default Disabling username in add client form

Is there a way to disallow modifing of "username" field when a reseller edits a client?

As I could see, if I disable it, it is disabled to when creating... so, where do I have to modify to avoid this behavior?

As I recall, if username is used as a prefix for ftp/database, is not a good idea to modify the user name of a client.

Thanks
Reply With Quote
Sponsored Links
  #2  
Old 21st February 2012, 17:03
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,496
Thanks: 813
Thanked 5,263 Times in 4,127 Posts
Default

Quote:
Is there a way to disallow modifing of "username" field when a reseller edits a client?
There is no such function available.

Quote:
s I recall, if username is used as a prefix for ftp/database, is not a good idea to modify the user name of a client.
Thats why I use the clientid as prefix for all servivces on my servers and not the username.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 22nd February 2012, 14:27
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Thanks Till, I want to implement a restriction, but the problem is that the same code is used to add new client and to modify an existing one. Maybe I could create a copy of the file, and, if it is a modification, call the new one...

Another solution could be to remove the username in the update sentence when saving client, could you say me please where is that sentence?

Thanks in advance, maybe in a future I will switch to clientid, but it is not possible right now
Reply With Quote
  #4  
Old 22nd February 2012, 14:29
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,496
Thanks: 813
Thanked 5,263 Times in 4,127 Posts
Default

Quote:
Thanks Till, I want to implement a restriction, but the problem is that the same code is used to add new client and to modify an existing one. Maybe I could create a copy of the file, and, if it is a modification, call the new one...
The form "knows" if its in edit or add mode. Take a look e.g. at the website edit, database edit or email domain edit file to see how a field is disabled on edit in ispconfig.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 22nd February 2012, 17:13
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Thanks Till!!! I made some changes and it is working. If it could be userfull, I can paste here the code, maybe with a little modification in server settings a feature like "disable username change" could be implemented, for people like me that prefers loss functionality in pro of using username instead client_id

Thanks again
Reply With Quote
  #6  
Old 22nd February 2012, 17:36
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,496
Thanks: 813
Thanked 5,263 Times in 4,127 Posts
Default

Please post your code, I will check how we can integrate this in ispconfig.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 22nd February 2012, 18:15
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
 
Default

Two files must be edited. I think this could be applied when creating resellers too, I didn't try it yet

/usr/local/ispconfig/interface/web/client/client_edit.php

At line (aprox): 129

Add this code before "parent:nShowEnd():"
Code:
                if($this->id > 0) {
                        //* we are editing a existing record
                        $app->tpl->setVar("edit_disabled", 1);
                } else {
                        $app->tpl->setVar("edit_disabled", 0);
                }
/usr/local/ispconfig/interface/web/client/templates/client_edit_address.htm

At line (aprox): 20 -Inside "<div class="ctrlHolder">"

This lines must be replaced:

Code:
        <label for="username">{tmpl_var name='username_txt'}*</label>
        <input name="username" id="username" value="{tmpl_var name='username'}" size="30" maxlength="255" type="text" class="textInput" />
with this lines:

Code:
<tmpl_if name="edit_disabled">
        <label for="username">{tmpl_var name='username_txt'}*</label>
        <input name="username" id="username" disabled="disabled" value="{tmpl_var name='username'}" size="30" maxlength="255" type="text" class="textInput" />
        <input name="username" type="hidden" value="{tmpl_var name='username'}" />
<tmpl_else>
        <label for="username">{tmpl_var name='username_txt'}*</label>
        <input name="username" id="username" value="{tmpl_var name='username'}" size="30" maxlength="255" type="text" class="textInput" />
</tmpl_if>
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPConfig - Allow client to add new site? rnagy86 General 1 3rd October 2007 13:36
Add a site to a client kippi General 2 25th January 2007 11:51
Client username length bug bwragg Installation/Configuration 2 8th January 2007 12:41
Add Existing Site to Client? mphetameme General 3 10th September 2006 00:59
vsftp - 550 Failed to change directory latcarf Server Operation 8 14th May 2006 02:05


All times are GMT +2. The time now is 11:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.