B3rt Posted January 27, 2006 Share Posted January 27, 2006 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 More sharing options...
LFA Posted January 28, 2006 Share Posted January 28, 2006 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 More sharing options...
Jissh Posted January 28, 2006 Share Posted January 28, 2006 <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 More sharing options...
B3rt Posted January 28, 2006 Author Share Posted January 28, 2006 Thx, that is no problem that they are overwritten in an update. This way it fixes for me some minor shortcomings of the panel, I mean some features it misses for me. Link to comment Share on other sites More sharing options...
ECF Posted January 28, 2006 Share Posted January 28, 2006 Why exactly would you want to stop your users from changing their password. What benefit would it provide? Link to comment Share on other sites More sharing options...
B3rt Posted January 29, 2006 Author Share Posted January 29, 2006 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 More sharing options...
ECF Posted January 29, 2006 Share Posted January 29, 2006 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 More sharing options...
B3rt Posted January 29, 2006 Author Share Posted January 29, 2006 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 More sharing options...
ECF Posted January 29, 2006 Share Posted January 29, 2006 I see. Link to comment Share on other sites More sharing options...
LFA Posted January 29, 2006 Share Posted January 29, 2006 try this: <% if TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.Admin then %> ... <% end if %> put everything you want hidden between the tags Link to comment Share on other sites More sharing options...
B3rt Posted January 29, 2006 Author Share Posted January 29, 2006 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 More sharing options...
LFA Posted January 29, 2006 Share Posted January 29, 2006 I don't think you can just add readonly to the textbox. Just put the whole page between the if and end if so regular users get a blank page. Link to comment Share on other sites More sharing options...
B3rt Posted January 29, 2006 Author Share Posted January 29, 2006 The readonly works If you just add readonly then that field is readonly (tried it and worked perfectly), I just don't understand why the if and else does not work and why it gives an error. Link to comment Share on other sites More sharing options...
LFA Posted January 29, 2006 Share Posted January 29, 2006 could be because the objects have the same id Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.