public void Authenticate(Context ctx, AuthenticateType authType) { var passw = ctx.QueryParam("password"); bool authenticated = false; if ((authType & AuthenticateType.OneTimeToken) != 0) { authenticated = AuthenticateWithOneTimePassword(ctx.Userprofile, passw); } if (!authenticated && (authType & AuthenticateType.Password) != 0) { authenticated = (ctx.Userprofile.Password.StartsWith("md5:")) ? ctx.Userprofile.Password.Substring(4) == Hash.MD5(passw) : ctx.Userprofile.Password == passw; } if (!authenticated) { throw new AccessDeniedException("Bad Password"); } }
private void SetAuthGroupBoxEnabled() { AuthenticateType authType = (AuthenticateType)Enum.Parse(typeof(AuthenticateType), (string)comboBoxAuthenticateType.SelectedValue); groupBoxAuth.Enabled = (authType == AuthenticateType.Basic); }