Jump to content

Editing template files, which command?


B3rt

Recommended Posts

I wish to edit a default template file.

 

The file I whis to edit is:

 

C:\Program Files\TCAdmin Control Panel\Web\Templates\Default\change_password.aspx

 

 

 

What I would like to change is the ability to change passwords, I wish that only admins can do this, so the user itself cannot change this settings.

 

 

 

What must I add in the template so only admins van edit?

 

 

 

looking for something like this:

 

<div class="pre"><pre>

</TR>

<TR id="CurrentPasswordRow" runat="server">

<TD align="right"><asp:label id="Label1" runat="server" CssClass="description_labels">Current Password:</asp:label> 

</TD>

<TD><asp:textbox id="CurrentPassword" runat="server" CssClass="default_inputs" TextMode="Password"

MaxLength="25"></asp:textbox></TD>

<TD>  </TD>

</TR>

 

if($user=="admin") {

 

<TR>

<TD></TD>

<TD> </TD>

<TD> </TD>

</TR>

<TR>

<TD align="right">

<asp:label id="Label2" runat="server" CssClass="description_labels">New Password:</asp:label> 

</TD>

<TD><asp:textbox id="NewPassword" runat="server" CssClass="default_inputs" TextMode="Password" MaxLength="25"></asp:textbox></TD>

<TD></TD>

</TR>

 

<TR>

<TD align="right"><asp:label id="Label4" runat="server" CssClass="description_labels">Confirm Password:</asp:label> 

</TD>

<TD><asp:textbox id="ConfirmPassword" runat="server" CssClass="default_inputs" TextMode="Password"

MaxLength="25"></asp:textbox></TD>

<TD></TD>

</TR>

 

 

 

<TR>

<TD></TD>

<TD> </TD>

<TD> </TD>

</TR>

}

</pre></div>

 

 

 

Ofcourse this would not work, so could please someone tell me wich code is used for identifying the admin?

 

 

 

Just disabling the change button for users and subusers would also do the trick.

Link to comment
Share on other sites

What you want is this:

 

 

 

if(TCAdminSDK.Web.Session.CurrentUserType == TCAdminSDK.Objects.UserType.Admin){

 

...

 

...

 

}

 

 

 

 

 

Changing the files directly is not supported by us, and the changes you make will be overwritten when you run the web update.

Link to comment
Share on other sites

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td class="SmallText">Quote:</td></tr><tr><td class="quote">

the changes you make will be overwritten when you run the web update

</td></tr></table>

 

 

 

Yeah I noticed so I just reupload the files I changed after I update, only takes an extra seccond.

Link to comment
Share on other sites

We have allready a support panel running and 1 of the options of this panel is to login directly into the tcadmin panel.

 

But if the user changes his password then we cannot login directly anymore into the panel itself using the following option:

 

http://support.tcadmin.com/index.php?pf=kb&page=index_v2 &id=3&c=3

 

 

 

That is why I don't want that the user changes its password, I also would like that user only could login from our website, so they must visit our website first before login in.

 

This is usefull so users/customers can read our news and anouncements if we have maintenance or other news to report. If users connect directly to the panel you have a major risk that those users seldom visit your website and miss all anouncements maid by us.

 

 

 

 

Link to comment
Share on other sites

You can change the code to allow them not to change it. And simply send the mainpage you would like them to sign in at via the welcome email.

 

 

 

Or you can also use the internal news system of tcadmin to post news to all your game users.

Link to comment
Share on other sites

What you want is this:

 

 

 

if(TCAdminSDK.Web.Session.CurrentUserType == TCAdminSDK.Objects.UserType.Admin){

 

...

 

...

 

}

 

 

 

 

 

 

 

This does not work.

 

The code is now vissable as plain text in the template file wheb you go to change your password

 

 

 

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td class="SmallText">Quote:</td></tr><tr><td class="quote">

 

 

Or you can also use the internal news system of tcadmin to post news to all your game users.

</td></tr></table>

 

Not an option for us, we also have a lot of Linux servers running, they are controlled by you own support panel, if I have to use the build in news account in tcadmin I always have to publish news our anouncements twice.

 

 

Link to comment
Share on other sites

I am not a ASP scripter myself, I script in PHP, I don't understand the ASP scripting language at all.

 

 

 

I changed the code as you suggested and indeed it worked, so I tried something else.

 

I try to make a field readonly as user and not if admin.

 

 

 

For some stupid reason I cannot get it to work.

 

 

 

If I just add readonly too the line the field becomes indeed readonly and the script works, but when I add the line which you suggested for admin the scripts errors.

 

For example this simple code change gives an error, I believe it is correct but it seems not to be:

 

<div class="pre"><pre>

<%

if TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.Admin then

%>

<TD><asp:textbox id="NewPassword" runat="server" CssClass="default_inputs" TextMode="Password" MaxLength="25"></asp:textbox></TD>

<%

else

%>

<TD><asp:textbox id="NewPassword" runat="server" CssClass="default_inputs" TextMode="Password" MaxLength="25" readonly></asp:textbox></TD>

<%

end if

%>

</pre></div>

 

 

 

What is wrong with this code, why does this not work?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 42 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use