mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-07 21:51:13 -07:00
Hooked up most of #49 Just the validation messages need to be done.
***NOTE: Due to we are now hashing the passwords and reading from a new table, We will need to create a new administrator account.***
This commit is contained in:
parent
da8b6340ae
commit
8f7098d048
13 changed files with 250 additions and 21 deletions
|
@ -30,6 +30,8 @@ using System.Dynamic;
|
|||
using Nancy;
|
||||
using Nancy.Authentication.Forms;
|
||||
using Nancy.Extensions;
|
||||
using Nancy.Responses.Negotiation;
|
||||
using Nancy.Security;
|
||||
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.UI.Models;
|
||||
|
@ -81,7 +83,6 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
return View["Login/Register", model];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Post["/register"] = x =>
|
||||
|
@ -96,6 +97,30 @@ namespace PlexRequests.UI.Modules
|
|||
Session[SessionKeys.UsernameKey] = username;
|
||||
return this.LoginAndRedirect((Guid)userId);
|
||||
};
|
||||
|
||||
Get["/changepassword"] = _ => ChangePassword();
|
||||
Post["/changepassword"] = _ => ChangePasswordPost();
|
||||
}
|
||||
|
||||
private Negotiator ChangePassword()
|
||||
{
|
||||
this.RequiresAuthentication();
|
||||
return View["ChangePassword"];
|
||||
}
|
||||
|
||||
private Negotiator ChangePasswordPost()
|
||||
{
|
||||
var username = Context.CurrentUser.UserName;
|
||||
var oldPass = Request.Form.OldPassword;
|
||||
var newPassword = Request.Form.NewPassword;
|
||||
var newPasswordAgain = Request.Form.NewPasswordAgain;
|
||||
if (!newPassword.Equals(newPasswordAgain))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var result = UserMapper.UpdateUser(username, oldPass, newPassword);
|
||||
return View["ChangePassword"];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue