Skip to content

Commit

Permalink
Merge pull request #176 from BenediktMKuehne/first-release
Browse files Browse the repository at this point in the history
Pre-release cleanup
  • Loading branch information
m-1-k-3 authored Dec 11, 2023
2 parents ae8aa60 + 3e6d88b commit cff84e3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 52 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/first-interaction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: First interaction

on:
- pull_request_target
- issues

jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write

steps:
- uses: actions/first-interaction@v1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
issue-message: |
Thank you for contributing an issue!
**Welcome to the EMBA firmware analysis community!**
We are glad you are here and appreciate your contribution. Please keep in mind our contributing guidelines [here](https://github.com/e-m-b-a/embark/blob/master/CONTRIBUTING.md) and [here](https://github.com/e-m-b-a/embark/blob/master/CONTRIBUTORS.md).
Also, please check [existing open issues](https://github.com/e-m-b-a/embark/issues) and consider to open a discussion in the dedicated [discussion area](https://github.com/e-m-b-a/embark/discussions).
Additionally, we have collected a lot of details around EMBArk, the installation and the usage of EMBArk in our [Wiki](https://github.com/e-m-b-a/embark/wiki).
If you like _EMBA_ you have the chance to support us by becoming a [Sponsor](https://github.com/sponsors/e-m-b-a) or buying some beer [here](https://www.buymeacoffee.com/securefirmware).
This is an automatic message. Allow for time for the EMBA community to be able to read the issue and comment on it.
pr-message: |
Thank you for contributing a pull request!
**Welcome to the EMBA firmware analysis community!**
We are glad you are here and appreciate your contribution. Please keep in mind our contributing guidelines [here](https://github.com/e-m-b-a/embark/blob/master/CONTRIBUTING.md) and [here](https://github.com/e-m-b-a/embark/blob/master/CONTRIBUTORS.md).
Also, please check [existing open issues](https://github.com/e-m-b-a/embark/issues) and consider to open a discussion in the dedicated [discussion area](https://github.com/e-m-b-a/embark/discussions).
Additionally, we have collected a lot of details around EMBArk, the installation and the usage of EMBArk in our [Wiki](https://github.com/e-m-b-a/embark/wiki).
If you like _EMBA_ you have the chance to support us by becoming a [Sponsor](https://github.com/sponsors/e-m-b-a) or buying some beer [here](https://www.buymeacoffee.com/securefirmware).
This is an automatic message. Allow for time for the EMBA community to be able to read the pull request and comment on it.
2 changes: 1 addition & 1 deletion embark/embark/settings/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
SECRET_KEY = os.environ.get('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False

ALLOWED_HOSTS = ['*']

Expand Down
14 changes: 2 additions & 12 deletions embark/templates/user/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,14 @@
{% block title %}EMBArk login{% endblock title %}
{% block maincontent %}
<div class="login-form-container">
{% if error_message %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<medium>{{ message }}</medium>
</div>
{% endif %}
{% if success_message %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
<medium>{{ message }}</medium>
</div>
{% endif %}
<div id="embarkLogo">
<img src="{% static 'content/images/embark_logo.svg' %}" alt="EMBArk logo graphic" height="auto" width="auto"/>
</div>
<div class="d-flex justify-content-center">
<h3><span class="badge bg-secondary">New</span>Per-user timezone settings in the user menu</h3>
<h2><span class="badge bg-primary">New</span> Version 0.1</h2>
</div>
<div class="d-flex justify-content-center">
<h3><span class="badge bg-secondary">New</span>New Buttons everywhere</h3>
<h3><span class="badge bg-secondary">New</span> New Buttons everywhere</h3>
</div>
<div class="login">
<form action="{% url 'embark-login' %}" class="login-form" method="post">
Expand Down
75 changes: 36 additions & 39 deletions embark/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,25 @@ def register(request):
username = body['username']
password = body['password']
confirm_password = body['confirm_password']

if password == confirm_password:
logger.debug('Passwords match. Creating user')
user = User.objects.create(username=username)
user.set_password(password)
user.save()
logger.debug('User created')
else:
if password != confirm_password:
logger.debug('Passwords do not match')
return render(
request,
'user/register.html',
{'error_message': True, 'message': 'Passwords do not match.'}
)

return render(
request,
'user/login.html',
{'success_message': True, 'message': 'Registration successful.'}
)

messages.success(request, 'Passwords do not match.')
return render(request, 'user/register.html')
logger.debug('Passwords match. Creating user')
user = User.objects.create(username=username)
user.set_password(password)
user.save()
logger.debug('User created')
messages.success(request, 'Registration successful.')
return redirect('../../')
except KeyError:
logger.exception('Missing keys from data- Username, password, password_confirm')
return render(request, 'user/register.html', {'error_message': True, 'message': 'User data is invalid.'})
messages.error(request, 'User data is missing/invalid.')
return render(request, 'user/register.html')
except builtins.Exception as error:
logger.exception('Wide exception in Signup: %s', error)
return render(
request,
'user/register.html',
{'error_message': True, 'message': 'Something went wrong when signing up the user.'}
)
messages.error(request, 'Something went wrong when signing up the user.')
return render(request, 'user/register.html')
return render(request, 'user/register.html')


Expand All @@ -83,7 +71,8 @@ def embark_login(request):
password = body['password']
except KeyError:
logger.exception('Missing keys from data- Username and password')
return render(request, 'user/login.html', {'error_message': True, 'message': 'Username or password are wrong.'})
messages.error(request, 'Username or password are wrong.')
return render(request, 'user/login.html')

logger.debug('Found user name and password')
user = authenticate(request, username=username, password=password)
Expand All @@ -96,12 +85,12 @@ def embark_login(request):
return redirect('../../dashboard/main/')
# else:
logger.debug('User could not be authenticated')
messages.info(request, "Invalid user data")
return render(request, 'user/login.html', {'error_message': True, 'message': 'Invalid user data.'})
messages.error(request, "Invalid user data")
return render(request, 'user/login.html')
except builtins.Exception as error:
logger.exception('Wide exception in Signup: %s', error)
messages.info(request, "Invalid user data")
return render(request, 'user/login.html', {'error_message': True, 'message': 'Something went wrong when logging in the user.'})
messages.error(request, 'Something went wrong when logging in the user.')
return render(request, 'user/login.html')
return render(request, 'user/login.html')


Expand All @@ -110,7 +99,8 @@ def embark_login(request):
def embark_logout(request): # FIXME this just flushes session_id??!
logout(request=request)
logger.debug("Logout user %s", request)
return render(request, 'user/login.html', {'success_message': True, 'message': 'Logout successful.'})
messages.success(request, 'Logout successful.')
return render(request, 'user/login.html')


@login_required(login_url='/' + settings.LOGIN_URL)
Expand All @@ -132,26 +122,32 @@ def password_change(request):
if user.check_password(old_password):
if old_password == new_password:
logger.debug('New password = old password')
return render(request, 'user/passwordChange.html', {'error_message': True, 'message': 'New password matches the old password'})
messages.error(request, 'New password matches the old password')
return render(request, 'user/passwordChange.html')
if new_password == confirm_password:
user.set_password(new_password)
user.save()
authenticate(request, username=user.username, password=new_password)
login(request, user)
logger.debug('New password set, user authenticated')
return render(request, 'user/passwordChangeDone.html', {'success_message': True, 'message': 'Password change successful.'})
messages.success(request, 'Password change successful.')
return render(request, 'user/passwordChangeDone.html')
else:
logger.debug('Passwords do not match')
return render(request, 'user/passwordChange.html', {'error_message': True, 'message': 'Passwords do not match.'})
messages.error(request, 'Passwords do not match.')
return render(request, 'user/passwordChange.html')
else:
logger.debug('Old password is incorrect')
return render(request, 'user/passwordChange.html', {'error_message': True, 'message': 'Old password is incorrect.'})
messages.error(request, 'Old password is incorrect.')
return render(request, 'user/passwordChange.html')
except KeyError:
logger.exception('Missing keys from data-passwords')
return render(request, 'user/passwordChange.html', {'error_message': True, 'message': 'Some fields are empty!'})
messages.error(request, 'Some fields are empty!')
return render(request, 'user/passwordChange.html')
except builtins.Exception as error:
logger.exception('Wide exception in Password Change: %s', error)
return render(request, 'user/passwordChange.html', {'error_message': True, 'message': 'Something went wrong when changing the password for the user.'})
messages.error(request, 'Something went wrong when changing the password for the user.')
return render(request, 'user/passwordChange.html')
return render(request, 'user/passwordChange.html')


Expand All @@ -167,7 +163,8 @@ def acc_delete(request):
"%H:%M:%S") # workaround for not duplicating entry users_user.username
user.is_active = False
user.save()
return render(request, 'user/register.html', {'success_message': True, 'message': 'Account successfully deleted.'})
messages.success(request, 'Account successfully deleted.')
return render(request, 'user/register.html') # TODO should be redirect
return render(request, 'user/accountDelete.html')


Expand Down

0 comments on commit cff84e3

Please sign in to comment.