Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more tests and bug fixes #1163

Merged
merged 14 commits into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/forgot_password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/usage/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In case user forgets his password, he can follow the steps shown below to reset
.. figure:: /images/forgot_password.png
:align: center

Provide the email of the account for which you want to reset password
Provide the username/email of the account for which you want to reset password

.. figure:: /images/otp_sent.png
:align: center
Expand Down
4 changes: 2 additions & 2 deletions owtf/api/handlers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def post(self):
response = {"status": "success", "message": "Otp Send Successful"}
self.success(response)
else:
err = {"status": "fail", "message": "Email/Username doesn't exist"}
err = {"status": "fail", "message": "Username / Email doesn't exist"}
self.success(err)


Expand Down Expand Up @@ -510,7 +510,7 @@ def post(self):
else:
self.success({"status": "fail", "message": "Invalid OTP"})
else:
err = {"status": "fail", "message": "Email doesn't exist"}
err = {"status": "fail", "message": "Username / Email doesn't exist"}
self.success(err)


Expand Down
2 changes: 0 additions & 2 deletions owtf/api/handlers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
from owtf.lib import exceptions
from owtf.lib.exceptions import APIError
from owtf.managers.config import get_all_config_dicts, update_config_val
from owtf.api.handlers.jwtauth import jwtauth

__all__ = ["ConfigurationHandler"]


@jwtauth
class ConfigurationHandler(APIRequestHandler):
"""Update framework settings and tool paths."""

Expand Down
5 changes: 3 additions & 2 deletions owtf/models/user_login_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
~~~~~~~~~~~~~~~~

"""
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, UniqueConstraint
from owtf.db.model_base import Model
import uuid
from datetime import datetime, timedelta
from owtf.settings import JWT_EXP_DELTA_SECONDS
from owtf.models.user import User


class UserLoginToken(Model):
__tablename__ = "user_login_tokens"

id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column(Integer, ForeignKey("users.id"))
user_id = Column(Integer, ForeignKey(User.id))
token = Column(String, nullable=False)

@classmethod
Expand Down
1 change: 0 additions & 1 deletion owtf/webapp/src/containers/Dashboard/GithubReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class GithubReport extends React.Component {

render() {
const errorData = this.props.errors;
console.log("errorData", errorData);
return (
<Pane data-test="githubReportComponent">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ exports[`Dashboard component Testing Worker panel component Testing worker compo
>
<img
className="workerpanel-labelimg"
src="/static/b0ac8b98e2b251549cd044fe7d5d7edd.png"
src={Object {}}
/>
<withTheme(Paragraph)
margin={10}
Expand Down
37 changes: 30 additions & 7 deletions owtf/webapp/src/containers/Dashboard/api.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
import Request from "../../utils/request";
import { API_BASE_URL } from "../../utils/constants";

const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
}
};

export function getErrorsAPI() {
const requestURL = `${API_BASE_URL}errors/`;
// Call our request helper (see 'utils/request')
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
}
};
const request = new Request(requestURL, options);
return request.get.bind(request);
}

export function postErrorAPI() {
const requestURL = `${API_BASE_URL}errors/`;
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
}
};
const request = new Request(requestURL, options);
return request.post.bind(request);
}

export function deleteErrorAPI(action) {
const error_id = action.error_id.toString();
const requestURL = `${API_BASE_URL}errors/${error_id}/`;
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
}
};
const req_options = {
responseAs: "text",
...options
Expand All @@ -35,13 +46,25 @@ export function deleteErrorAPI(action) {
export function getSeverityAPI() {
const requestURL = `${API_BASE_URL}dashboard/severitypanel/`;
// Call our request helper (see 'utils/request')
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string interpolation using backticks might be cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

}
};
const request = new Request(requestURL, options);
return request.get.bind(request);
}

export function getTargetSeverityAPI() {
const requestURL = `${API_BASE_URL}targets/severitychart/`;
// Call our request helper (see 'utils/request')
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Authorization: "Bearer " + localStorage.getItem("token")
}
};
const request = new Request(requestURL, options);
return request.get.bind(request);
}
16 changes: 6 additions & 10 deletions owtf/webapp/src/containers/EmailVerification/api.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import Request from "../../utils/request";
import { API_BASE_URL } from "../../utils/constants";

const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
}
};

export function confirmEmailGenerateAPI() {
const requestURL = `${API_BASE_URL}generate/confirm_email/`;
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
}
};
const request = new Request(requestURL, options);
return request.post.bind(request);
}

export function verifyEmailGenerateAPI(link) {
const requestURL = `${API_BASE_URL}verify/confirm_email/` + link;
const options = {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
}
};
const request = new Request(requestURL, options);
return request.get.bind(request);
}
Loading