Fixed and closed #452: no longer possible to delete yourself in admin panel.
Fixed and closed #453: gracefully handled inexistent username in session state.
This commit is contained in:
parent
12d7c32635
commit
4159171c63
4 changed files with 26 additions and 14 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
|||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.0.1.451")]
|
||||
[assembly: AssemblyFileVersion("3.0.1.451")]
|
||||
[assembly: AssemblyVersion("3.0.1.452")]
|
||||
[assembly: AssemblyFileVersion("3.0.1.452")]
|
||||
|
|
|
@ -52,9 +52,17 @@ namespace ScrewTurn.Wiki {
|
|||
else if(un == AnonymousUsername) return Users.GetAnonymousAccount();
|
||||
else {
|
||||
current = Users.FindUser(un);
|
||||
if(current != null) SessionCache.SetCurrentUser(sessionId, current);
|
||||
if(current != null) {
|
||||
SessionCache.SetCurrentUser(sessionId, current);
|
||||
return current;
|
||||
}
|
||||
else {
|
||||
// Username is invalid
|
||||
Session.Clear();
|
||||
Session.Abandon();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else return null;
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace ScrewTurn.Wiki {
|
|||
providerSelector.Enabled = false;
|
||||
btnCreate.Visible = false;
|
||||
btnSave.Visible = true;
|
||||
btnDelete.Visible = true;
|
||||
btnDelete.Visible = user.Username != SessionFacade.CurrentUsername;
|
||||
rfvPassword1.Enabled = false;
|
||||
cvUsername.Enabled = false;
|
||||
lblPasswordInfo.Visible = true;
|
||||
|
|
|
@ -627,16 +627,18 @@ namespace ScrewTurn.Wiki {
|
|||
/// </summary>
|
||||
private void SetupEmailNotification() {
|
||||
if(SessionFacade.LoginKey != null && SessionFacade.CurrentUsername != "admin") {
|
||||
bool pageChanges;
|
||||
bool discussionMessages;
|
||||
bool pageChanges = false;
|
||||
bool discussionMessages = false;
|
||||
|
||||
UserInfo user = Users.FindUser(SessionFacade.CurrentUsername);
|
||||
if(user.Provider.UsersDataReadOnly) {
|
||||
UserInfo user = SessionFacade.GetCurrentUser();
|
||||
if(user != null && user.Provider.UsersDataReadOnly) {
|
||||
btnEmailNotification.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(user != null) {
|
||||
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
||||
}
|
||||
|
||||
bool active = false;
|
||||
if(discussMode) {
|
||||
|
@ -659,11 +661,13 @@ namespace ScrewTurn.Wiki {
|
|||
}
|
||||
|
||||
protected void btnEmailNotification_Click(object sender, EventArgs e) {
|
||||
bool pageChanges;
|
||||
bool discussionMessages;
|
||||
bool pageChanges = false;
|
||||
bool discussionMessages = false;
|
||||
|
||||
UserInfo user = Users.FindUser(SessionFacade.CurrentUsername);
|
||||
UserInfo user = SessionFacade.GetCurrentUser();
|
||||
if(user != null) {
|
||||
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
||||
}
|
||||
|
||||
if(discussMode) {
|
||||
Users.SetEmailNotification(user, currentPage, pageChanges, !discussionMessages);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue