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
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.451")]
|
[assembly: AssemblyVersion("3.0.1.452")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.451")]
|
[assembly: AssemblyFileVersion("3.0.1.452")]
|
||||||
|
|
|
@ -52,9 +52,17 @@ namespace ScrewTurn.Wiki {
|
||||||
else if(un == AnonymousUsername) return Users.GetAnonymousAccount();
|
else if(un == AnonymousUsername) return Users.GetAnonymousAccount();
|
||||||
else {
|
else {
|
||||||
current = Users.FindUser(un);
|
current = Users.FindUser(un);
|
||||||
if(current != null) SessionCache.SetCurrentUser(sessionId, current);
|
if(current != null) {
|
||||||
|
SessionCache.SetCurrentUser(sessionId, current);
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Username is invalid
|
||||||
|
Session.Clear();
|
||||||
|
Session.Abandon();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return null;
|
else return null;
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace ScrewTurn.Wiki {
|
||||||
providerSelector.Enabled = false;
|
providerSelector.Enabled = false;
|
||||||
btnCreate.Visible = false;
|
btnCreate.Visible = false;
|
||||||
btnSave.Visible = true;
|
btnSave.Visible = true;
|
||||||
btnDelete.Visible = true;
|
btnDelete.Visible = user.Username != SessionFacade.CurrentUsername;
|
||||||
rfvPassword1.Enabled = false;
|
rfvPassword1.Enabled = false;
|
||||||
cvUsername.Enabled = false;
|
cvUsername.Enabled = false;
|
||||||
lblPasswordInfo.Visible = true;
|
lblPasswordInfo.Visible = true;
|
||||||
|
|
|
@ -627,16 +627,18 @@ namespace ScrewTurn.Wiki {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetupEmailNotification() {
|
private void SetupEmailNotification() {
|
||||||
if(SessionFacade.LoginKey != null && SessionFacade.CurrentUsername != "admin") {
|
if(SessionFacade.LoginKey != null && SessionFacade.CurrentUsername != "admin") {
|
||||||
bool pageChanges;
|
bool pageChanges = false;
|
||||||
bool discussionMessages;
|
bool discussionMessages = false;
|
||||||
|
|
||||||
UserInfo user = Users.FindUser(SessionFacade.CurrentUsername);
|
UserInfo user = SessionFacade.GetCurrentUser();
|
||||||
if(user.Provider.UsersDataReadOnly) {
|
if(user != null && user.Provider.UsersDataReadOnly) {
|
||||||
btnEmailNotification.Visible = false;
|
btnEmailNotification.Visible = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(user != null) {
|
||||||
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
||||||
|
}
|
||||||
|
|
||||||
bool active = false;
|
bool active = false;
|
||||||
if(discussMode) {
|
if(discussMode) {
|
||||||
|
@ -659,11 +661,13 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void btnEmailNotification_Click(object sender, EventArgs e) {
|
protected void btnEmailNotification_Click(object sender, EventArgs e) {
|
||||||
bool pageChanges;
|
bool pageChanges = false;
|
||||||
bool discussionMessages;
|
bool discussionMessages = false;
|
||||||
|
|
||||||
UserInfo user = Users.FindUser(SessionFacade.CurrentUsername);
|
UserInfo user = SessionFacade.GetCurrentUser();
|
||||||
|
if(user != null) {
|
||||||
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
Users.GetEmailNotification(user, currentPage, out pageChanges, out discussionMessages);
|
||||||
|
}
|
||||||
|
|
||||||
if(discussMode) {
|
if(discussMode) {
|
||||||
Users.SetEmailNotification(user, currentPage, pageChanges, !discussionMessages);
|
Users.SetEmailNotification(user, currentPage, pageChanges, !discussionMessages);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue